3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* ########################################################################## # PHP Benchmark Performance Script # # © 2010 Code24 BV # # # # Author : Alessandro Torrisi # # Company : Code24 BV, The Netherlands # # Date : July 31, 2010 # # version : 1.0 # # License : Creative Commons CC-BY license # # Website : http://www.php-benchmark-script.com # # # ########################################################################## */ function test_Math($count = 140000) { $time_start = microtime(true); $mathFunctions = array("abs", "acos", "asin", "atan", "bindec", "floor", "exp", "sin", "tan", "pi", "is_finite", "is_nan", "sqrt"); foreach ($mathFunctions as $key => $function) { if (!function_exists($function)) unset($mathFunctions[$key]); } for ($i=0; $i < $count; $i++) { foreach ($mathFunctions as $function) { $r = call_user_func_array($function, array($i)); } } return number_format(microtime(true) - $time_start, 3); } function test_StringManipulation($count = 130000) { $time_start = microtime(true); $stringFunctions = array("addslashes", "chunk_split", "metaphone", "strip_tags", "md5", "sha1", "strtoupper", "strtolower", "strrev", "strlen", "soundex", "ord"); foreach ($stringFunctions as $key => $function) { if (!function_exists($function)) unset($stringFunctions[$key]); } $string = "the quick brown fox jumps over the lazy dog"; for ($i=0; $i < $count; $i++) { foreach ($stringFunctions as $function) { $r = call_user_func_array($function, array($string)); } } return number_format(microtime(true) - $time_start, 3); } function test_Loops($count = 19000000) { $time_start = microtime(true); for($i = 0; $i < $count; ++$i); $i = 0; while($i < $count) ++$i; return number_format(microtime(true) - $time_start, 3); } function test_IfElse($count = 9000000) { $time_start = microtime(true); for ($i=0; $i < $count; $i++) { if ($i === -1) { } elseif ($i === -2) { } else if ($i === -3) { } } return number_format(microtime(true) - $time_start, 3); } $total = 0; $functions = get_defined_functions(); $line = str_pad("-",38,"-"); echo "<pre>$line\n|".str_pad("PHP BENCHMARK SCRIPT",36," ",STR_PAD_BOTH)."|\n$line\nStart : ".date("Y-m-d H:i:s")."\nServer : {$_SERVER['SERVER_NAME']}@{$_SERVER['SERVER_ADDR']}\nPHP version : ".PHP_VERSION."\nPlatform : ".PHP_OS. "\n$line\n"; foreach ($functions['user'] as $user) { if (preg_match('/^test_/', $user)) { $total += $result = $user(); echo str_pad($user, 25) . " : " . $result ." sec.\n"; } } echo str_pad("-", 38, "-") . "\n" . str_pad("Total time:", 25) . " : " . $total ." sec.</pre>";

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.3.120.0031.28416.20
7.3.110.0071.13616.14
7.3.100.0071.16615.82
7.3.90.0031.11916.00
7.3.80.0071.24016.16
7.3.70.0031.17615.79
7.3.60.0071.12315.95
7.3.50.0101.09915.96
7.3.40.0001.13015.92
7.3.30.0031.10415.97
7.3.20.0031.23717.93
7.3.10.0071.25917.63
7.3.00.0101.19317.71
7.2.240.0101.25715.85
7.2.230.0001.25216.18
7.2.220.0001.23216.01
7.2.210.0001.27216.14
7.2.200.0031.26916.21
7.2.190.0031.27616.16
7.2.180.0101.24616.13
7.2.170.0101.23616.14
7.2.160.0031.26816.14
7.2.150.0071.19817.89
7.2.140.0071.21717.96
7.2.130.0021.31617.86
7.2.120.0071.33117.95
7.2.110.0081.28317.82
7.2.100.0071.31317.91
7.2.90.0071.30617.91
7.2.80.0081.34517.92
7.2.70.0081.31117.97
7.2.60.0071.32317.84
7.2.50.0111.30617.92
7.2.40.0061.28418.00
7.2.30.0121.31117.94
7.2.20.0091.29617.70
7.2.10.0101.28917.84
7.2.00.0071.26218.47
7.1.330.0032.13816.84
7.1.320.0031.98716.93
7.1.310.0002.03616.84
7.1.300.0071.99516.84
7.1.290.0131.97716.70
7.1.280.0072.03316.82
7.1.270.0031.98016.66
7.1.260.0031.97616.69
7.1.250.0112.08416.98
7.1.70.0071.11318.28
7.1.60.1630.94919.17
7.1.50.0030.97717.89
7.1.00.0001.19322.90
7.0.200.0001.09317.48
7.0.140.0031.25722.79
7.0.100.0301.08720.75
7.0.90.0171.03720.68
7.0.80.0201.04720.63
7.0.70.0431.11320.72
7.0.60.0071.18320.68
7.0.50.0301.22321.09
7.0.40.0000.98720.75
7.0.30.0271.10020.67
7.0.20.0231.06020.71
7.0.10.0070.98320.75
7.0.00.0130.99720.63
5.6.280.0002.50022.22
5.6.250.0002.50021.81
5.6.240.0072.49321.87
5.6.230.0072.49321.67
5.6.220.0072.41321.56
5.6.210.0072.49321.72
5.6.200.0202.37022.13
5.6.190.0102.45322.17
5.6.180.0102.49022.18
5.6.170.0172.48322.18
5.6.160.0072.47322.16
5.6.150.0132.47322.21
5.6.140.0002.50022.15
5.6.130.0102.49022.18
5.6.120.0072.40022.13
5.6.110.0002.48722.28
5.6.100.0072.49322.13
5.6.90.0072.49322.09
5.6.80.0072.46721.58
5.6.70.0202.48021.53
5.6.60.0132.48721.57
5.6.50.0102.49021.62
5.6.40.0102.49021.53
5.6.30.0132.48721.65
5.6.20.0032.49721.58
5.6.10.0002.47721.55
5.6.00.0072.39721.54
5.5.380.0032.49721.68
5.5.370.0072.37321.26
5.5.360.0132.48721.44
5.5.350.0102.49021.70
5.5.340.0132.43721.68
5.5.330.0132.45721.80
5.5.320.0102.49021.98
5.5.310.0172.48322.05
5.5.300.0072.49321.83
5.5.290.0232.42321.82
5.5.280.0132.48721.93
5.5.270.0232.43021.66
5.5.260.0372.38321.80
5.5.250.0032.45321.75
5.5.240.0102.49021.27
5.5.230.0302.40021.30
5.5.220.2602.24021.38
5.5.210.0102.47321.08
5.5.200.0172.48321.34
5.5.190.0232.37721.16
5.5.180.0232.42721.14
5.5.160.0132.43021.16
5.5.150.0072.49321.36
5.5.140.0102.47321.40
5.5.130.0072.49321.30
5.5.120.0072.43320.99
5.5.110.0072.49321.32
5.5.100.0132.48721.28
5.5.90.0132.42021.10
5.5.80.0072.46721.26
5.5.70.0102.47321.17
5.5.60.0032.44021.11
5.5.50.0302.42721.09
5.5.40.0132.47020.95
5.5.30.0132.41321.05
5.5.20.0102.46320.97
5.5.10.0232.36320.97
5.5.00.0032.48021.17
5.4.450.0132.48720.49
5.4.440.0202.41020.24
5.4.430.0032.49720.52
5.4.420.0202.39720.27
5.4.410.0172.42020.02
5.4.400.0032.39719.86
5.4.390.0102.49020.04
5.4.380.0172.41719.98
5.4.370.0102.49020.02
5.4.360.0002.41719.85
5.4.350.0232.41719.96
5.4.340.0102.49020.26
5.4.320.0202.40719.91
5.4.310.0032.49719.98
5.4.300.0102.40720.15
5.4.290.0102.49020.17
5.4.280.0102.42320.21
5.4.270.0032.49720.05
5.4.260.0102.46320.05
5.4.250.0102.49020.04
5.4.240.0432.33720.07
5.4.230.0102.49020.02
5.4.220.0132.40319.96
5.4.210.0102.49019.98
5.4.200.0002.50019.99
5.4.190.2902.20720.11
5.4.180.0132.48720.17
5.4.170.0171.99719.81
5.4.160.0172.08719.72
5.4.150.0032.49719.97
5.4.140.0302.20717.23
5.4.130.0102.49017.35
5.4.120.0032.47317.41
5.4.110.0132.44017.32
5.4.100.0102.37717.39
5.4.90.0002.50017.58
5.4.80.0002.50017.52
5.4.70.0072.49017.54
5.4.60.0272.41017.23
5.4.50.0072.46317.36
5.4.40.0002.49717.49
5.4.30.0072.49317.55
5.4.20.0002.41317.31
5.4.10.0202.43017.29
5.4.00.0102.43716.72
5.3.290.0072.49315.64
5.3.280.0032.24715.55
5.3.270.0202.01715.44
5.3.260.0171.88715.43
5.3.250.2032.29315.50
5.3.240.0072.45715.36
5.3.230.0072.49315.59
5.3.220.0032.49715.55
5.3.210.0202.48015.49
5.3.200.0032.49715.57
5.3.190.0072.49315.53
5.3.180.0132.48715.52
5.3.170.0132.48715.54
5.3.160.0202.43315.28
5.3.150.0232.42715.30
5.3.140.0302.41715.31
5.3.130.0202.44315.28
5.3.120.0232.44715.33
5.3.110.0172.27015.22
5.3.100.0372.39314.80
5.3.90.0102.42714.86
5.3.80.0002.50014.93
5.3.70.3972.09714.87
5.3.60.0232.40714.68
5.3.50.0172.48314.89
5.3.40.0302.42714.71
5.3.30.0032.49714.82
5.3.20.0302.44314.51
5.3.10.0132.48714.61
5.3.00.0072.49314.48

preferences:
44.56 ms | 401 KiB | 5 Q