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)
8.0.00.0170.00317.18
7.4.130.0150.02617.01
7.4.120.0120.01616.93
7.4.110.0160.02117.09
7.4.100.0130.01116.92
7.4.90.0180.01416.92
7.4.80.0120.02517.01
7.4.70.0200.02516.99
7.4.60.0230.01717.16
7.4.50.0090.01917.04
7.4.40.0340.01117.21
7.4.30.0230.02817.09
7.4.20.0150.01917.04
7.4.10.0130.01417.12
7.4.00.0090.02817.02
7.3.250.0191.22217.12
7.3.240.0231.30617.07
7.3.230.0561.30517.02
7.3.220.0291.36717.05
7.3.210.0481.53417.04
7.3.200.0131.29517.15
7.3.190.0191.26517.00
7.3.180.0221.23417.15
7.3.170.0321.34716.89
7.3.160.0361.26417.55
7.3.150.0311.35817.37
7.3.140.0561.33116.91
7.3.130.0231.27917.40
7.3.120.0271.20517.06
7.3.110.0201.25017.27
7.3.100.0291.38317.19
7.3.90.0191.34417.13
7.3.80.0191.23217.20
7.3.70.0411.36917.07
7.3.60.0231.31817.13
7.3.50.0191.75317.15
7.3.40.0571.30216.96
7.3.30.0451.37717.07
7.3.20.0391.42717.20
7.3.10.0331.33216.98
7.3.00.0451.27417.12
7.2.340.0621.64317.48
7.2.330.0411.60817.28
7.2.320.0481.63117.36
7.2.310.0571.95517.45
7.2.300.0481.51317.30
7.2.290.0351.46217.52
7.2.280.0201.59817.34
7.2.270.0541.55417.50
7.2.260.0521.48117.41
7.2.250.0511.42117.42
7.2.240.0561.49717.33
7.2.230.0521.72717.43
7.2.220.0391.54617.09
7.2.210.0491.46117.29
7.2.200.0421.53617.21
7.2.190.0131.65717.09
7.2.180.0441.96317.25
7.2.170.0511.92217.21
7.2.160.0501.77217.27
7.2.150.0561.44617.28
7.2.140.0551.93917.21
7.2.130.2781.64817.44
7.2.120.0691.57617.11
7.2.110.0491.45617.23
7.2.100.0611.42917.24
7.2.90.0581.39117.43
7.2.80.0411.55017.36
7.2.70.0601.44117.36
7.2.60.0711.67817.41
7.2.50.0481.66117.43
7.2.40.0681.58617.48
7.2.30.0541.40317.26
7.2.20.0391.42717.42
7.2.10.0161.40717.35
7.2.00.0291.38217.26
7.1.330.1231.76216.36
7.1.320.0481.72216.21
7.1.310.0231.77716.32
7.1.300.0431.96716.31
7.1.290.0261.66416.19
7.1.280.0661.86216.19
7.1.270.0301.79016.39
7.1.260.0541.84116.32
7.1.250.0741.80816.13
7.1.240.0651.72816.11
7.1.230.0671.83116.35
7.1.220.0361.83116.11
7.1.210.0861.87916.22
7.1.200.0441.95816.26
7.1.190.0521.92416.13
7.1.180.0771.30516.13
7.1.170.0521.87716.27
7.1.160.0261.74016.44
7.1.150.0711.69516.38
7.1.140.0361.72916.28
7.1.130.0451.81616.39
7.1.120.0661.78116.34
7.1.110.0391.69616.28
7.1.100.0931.92416.13
7.1.90.0651.93316.23
7.1.80.0711.73116.47
7.1.70.0521.96916.29
7.1.60.0451.96016.34
7.1.50.0531.77416.33
7.1.40.0561.67416.29
7.1.30.0521.68216.18
7.1.20.0581.78816.36
7.0.330.0551.83815.97
7.0.320.0591.92915.95
7.0.310.1921.50816.00
7.0.300.0641.95216.06
7.0.290.0791.64315.81
7.0.280.0851.60615.69
7.0.270.0721.75615.88
7.0.260.0431.80716.00
7.0.250.0291.74415.99
7.0.240.0291.98215.95
7.0.230.0421.96116.23
7.0.220.0621.93715.93
7.0.210.0711.78915.93
7.0.200.0401.86116.02
7.0.190.0701.89115.95
7.0.180.0591.68615.83
7.0.170.0301.68116.10
7.0.160.0561.64815.80
5.6.400.0531.99816.96
5.6.390.0391.97817.22
5.6.380.0741.94116.97
5.6.370.0641.79516.95
5.6.360.0481.95116.79
5.6.350.0491.96117.09
5.6.340.0521.92516.99
5.6.330.0381.94416.98
5.6.320.0451.96617.15
5.6.310.0631.91516.91
5.6.20.0172.40015.32
5.6.10.0132.40815.27
5.6.00.0132.43915.24
5.5.180.0162.44511.93
5.5.170.0132.42015.50
5.5.160.0002.45412.07
5.5.150.0162.41811.94
5.5.140.0022.46212.19
5.5.130.0032.44311.70
5.5.120.0102.38012.20
5.5.110.0102.43912.13
5.5.100.0122.42412.21
5.5.90.0172.42511.98
5.5.80.0102.39812.48
5.5.70.0182.21812.14
5.5.60.0571.91212.39
5.5.50.0192.20512.02
5.5.40.0132.38112.00
5.5.30.0102.43912.30
5.5.20.0162.32912.20
5.5.10.0102.43012.29
5.5.00.0262.07912.24
5.4.340.0102.43312.09
5.4.330.0052.44512.02
5.4.320.0102.44111.97
5.4.310.0062.43311.89
5.4.300.0102.40912.10
5.4.290.0132.44912.10
5.4.280.0072.42511.89
5.4.270.0102.43011.82
5.4.260.0132.43011.97
5.4.250.0132.42711.99
5.4.240.0142.38512.38
5.4.230.0322.16611.81
5.4.220.0162.40411.93
5.4.210.0292.26211.95
5.4.200.0262.19911.92
5.4.190.0032.43812.15
5.4.180.0262.40011.86
5.4.170.0522.22212.30
5.4.160.0222.09311.75
5.4.150.0132.23111.71
5.4.140.0102.33811.90
5.4.130.0242.23812.06
5.4.120.0262.30212.15
5.4.110.0162.40811.95
5.4.100.0102.29112.11
5.4.90.0492.21311.89
5.4.80.0332.28012.05
5.4.70.0112.24212.21
5.4.60.0032.46612.10
5.4.50.0232.31712.21
5.4.40.0262.33212.11
5.4.30.0062.42111.89
5.4.20.0032.45212.36
5.4.10.0002.45512.04
5.4.00.0062.46311.89

preferences:
31.57 ms | 400 KiB | 5 Q