3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* ########################################################################## # PHP Benchmark Performance Script # # <A9> 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 # # # ########################################################################## */ set_time_limit(0); function get_microtime() { $time = microtime(true); if (is_string($time)) { list($f, $i) = explode(" ", $time); $time = intval($i) + floatval($f); } return $time; } function test_Math($count = 14000) { $time_start = get_microtime(); $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(get_microtime() - $time_start, 3); } function test_StringManipulation($count = 13000) { $time_start = get_microtime(); $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(get_microtime() - $time_start, 3); } function test_Loops($count = 1900000) { $time_start = get_microtime(); for($i = 0; $i < $count; ++$i); $i = 0; while($i++ < $count); return number_format(get_microtime() - $time_start, 3); } function test_IfElse($count = 900000) { $time_start = get_microtime(); for ($i=0; $i < $count; $i++) { if ($i == -1) { } elseif ($i == -2) { } else if ($i == -3) { } } return number_format(get_microtime() - $time_start, 3); } $total = 0; $functions = get_defined_functions(); $line = str_pad("-",38,"-"); echo "<pre>\n$line\n|".str_pad("PHP BENCHMARK SCRIPT",36," ",STR_PAD_BOTH)."|\n$line\nStart : ".date("Y-m-d H:i:s")."\nServer : ".php_uname()."\nPHP version : ".PHP_VERSION."\nPlatform : ".PHP_OS. "\n$line\n"; foreach ($functions['user'] as $user) { if (preg_match('/^test_/', $user)) { $result = $user(); $total += $result; echo str_pad($user, 25) . " : " . $result ." sec.\n"; } } echo str_pad("-", 38, "-") . "\n" . str_pad("Total time:", 25) . " : " . $total ." sec.\n</pre>\n";

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.0100.11716.29
7.3.110.0030.12115.79
7.3.100.0000.12116.12
7.3.90.0030.12215.57
7.3.80.0070.12015.71
7.3.70.0000.12015.88
7.3.60.0000.11915.96
7.3.50.0030.12815.88
7.3.40.0100.11215.68
7.3.30.0100.12615.67
7.3.20.0070.11017.57
7.3.10.0130.11217.58
7.3.00.0000.13317.54
7.2.240.0070.12916.11
7.2.230.0030.13816.12
7.2.220.0100.12615.94
7.2.210.0070.13216.00
7.2.200.0030.14616.15
7.2.190.0070.12616.09
7.2.180.0000.12115.89
7.2.170.0000.14516.02
7.2.160.0070.13216.28
7.2.150.0030.12617.89
7.2.140.0130.11817.91
7.2.130.0070.12217.59
7.2.120.0070.12617.80
7.2.110.0070.13517.83
7.2.100.0030.13417.77
7.2.90.0030.13317.91
7.2.80.0030.12917.91
7.2.70.0130.12117.92
7.2.60.0070.12718.00
7.2.50.0100.13518.06
7.2.40.0070.12417.78
7.2.30.0030.12717.94
7.2.20.0100.12217.66
7.2.10.0100.12417.68
7.2.00.0050.13718.94
7.1.330.0030.21416.68
7.1.320.0030.21616.81
7.1.310.0070.20516.76
7.1.300.0030.20516.89
7.1.290.0070.20916.79
7.1.280.0070.20516.89
7.1.270.0100.21616.64
7.1.260.0070.20416.82
7.1.250.0030.20616.86
7.1.70.0070.11418.16
7.1.60.0100.10419.32
7.1.50.0100.16617.98
7.1.00.0030.13323.18
7.0.200.0000.10817.48
7.0.140.0070.22722.67
7.0.110.0070.14320.66
7.0.100.0400.16320.77
7.0.90.0400.13720.69
7.0.80.0070.14020.68
7.0.70.0270.12720.70
7.0.60.0070.11020.67
7.0.50.0030.11720.65
7.0.40.0030.17320.41
7.0.30.0100.18020.27
7.0.20.0030.17020.20
7.0.10.0070.13720.23
7.0.00.0030.17720.18
5.6.280.0100.39322.13
5.6.260.0030.32021.68
5.6.250.0030.31021.81
5.6.240.0100.30021.79
5.6.230.0000.31721.32
5.6.220.0070.30021.56
5.6.210.0030.28321.85
5.6.200.0100.28321.32
5.6.190.0100.31021.39
5.6.180.0100.29321.33
5.6.170.0030.35021.54
5.6.160.0070.33321.48
5.6.150.0000.30021.51
5.6.140.0100.33021.88
5.6.130.0030.36021.89
5.6.120.0200.27021.54
5.6.110.0130.35321.49
5.6.100.0030.35721.60
5.6.90.0070.32721.49
5.6.80.0070.33320.89
5.6.70.0070.31320.86
5.6.60.0070.35320.87
5.6.50.0070.34020.83
5.6.40.0030.30020.90
5.6.30.0030.34720.76
5.6.20.0030.28721.06
5.6.10.0100.33020.86
5.6.00.0070.29021.10
5.5.380.0000.29318.57
5.5.370.0070.33718.45
5.5.360.0000.31318.60
5.5.350.0000.30718.52
5.5.340.0070.26318.91
5.5.330.0130.36718.84
5.5.320.0070.34018.98
5.5.310.0130.33318.99
5.5.300.0030.35718.88
5.5.290.0130.32318.86
5.5.280.0070.36018.91
5.5.270.0030.30718.96
5.5.260.0100.33718.83
5.5.250.0130.35318.77
5.5.240.0070.30018.38
5.5.230.0070.30318.23
5.5.220.0070.28718.33
5.5.210.0070.36718.21
5.5.200.0130.33718.18
5.5.190.0030.31318.21
5.5.180.0030.30718.21
5.5.160.0100.29718.23
5.5.150.0070.32318.30
5.5.140.0000.29718.20
5.5.130.0030.34318.34
5.5.120.0030.32318.27
5.5.110.0030.29318.24
5.5.100.0030.31318.24
5.5.90.0070.33018.17
5.5.80.0100.36718.18
5.5.70.0030.37018.11
5.5.60.0030.32318.30
5.5.50.0030.33318.26
5.5.40.0070.36318.10
5.5.30.0070.32318.19
5.5.20.0000.29018.29
5.5.10.0100.33318.16
5.5.00.0030.30018.29
5.4.450.0070.29320.11
5.4.440.0030.29720.07
5.4.430.0070.34720.18
5.4.420.0100.34720.21
5.4.410.0070.38720.00
5.4.400.0070.28319.73
5.4.390.0070.30019.89
5.4.380.0030.37319.73
5.4.370.0100.28719.95
5.4.360.0000.38019.90
5.4.350.0070.30319.96
5.4.340.0030.38319.78
5.4.320.0070.26019.75
5.4.310.0000.36019.84
5.4.300.0030.33020.14
5.4.290.0030.35019.83
5.4.280.0070.41720.04
5.4.270.0070.28719.86
5.4.260.0030.30019.73
5.4.250.0100.34019.92
5.4.240.0100.32719.73
5.4.230.0100.28719.73
5.4.220.0030.32319.82
5.4.210.0070.37020.04
5.4.200.0000.31719.95
5.4.190.0030.32019.95
5.4.180.0000.33319.94
5.4.170.0070.29719.72
5.4.160.0100.29019.76
5.4.150.0130.33019.98
5.4.140.0000.37017.19
5.4.130.0000.34017.26
5.4.120.0070.31717.21
5.4.110.0030.31017.40
5.4.100.0030.40317.21
5.4.90.0070.31317.36
5.4.80.0030.33017.23
5.4.70.0070.35017.22
5.4.60.0030.33017.38
5.4.50.0000.31017.14
5.4.40.0000.36017.19
5.4.30.0030.30317.24
5.4.20.0000.33317.18
5.4.10.0070.36017.19
5.4.00.0070.33316.65
5.3.290.0100.38015.71
5.3.280.0000.38315.72
5.3.270.0070.43015.65
5.3.260.0030.36015.61
5.3.250.0070.37315.84
5.3.240.0070.34315.84
5.3.230.0070.34015.59
5.3.220.0030.38315.83
5.3.210.0070.29015.61
5.3.200.0100.35715.61
5.3.190.0070.39315.55
5.3.180.0170.39315.56
5.3.170.0100.42015.66
5.3.160.0030.29715.80
5.3.150.0430.32315.68
5.3.140.0000.39315.57
5.3.130.0030.38715.60
5.3.120.0100.41715.68
5.3.110.0030.38715.54
5.3.100.0070.37715.03
5.3.90.0070.36715.17
5.3.80.0070.39715.04
5.3.70.0100.42015.00
5.3.60.0130.47315.09
5.3.50.0070.42714.96
5.3.40.0030.40315.21
5.3.30.0000.36014.89
5.3.20.0100.35014.92
5.3.10.0030.32014.69
5.3.00.0030.30314.84
5.2.170.0000.51312.02
5.2.160.0030.44012.10
5.2.150.0000.46012.21
5.2.140.0030.39712.02
5.2.130.0000.37312.20
5.2.120.0030.36312.02
5.2.110.0070.36012.16
5.2.100.0100.35312.00
5.2.90.0030.36712.00
5.2.80.0030.45712.00
5.2.70.0000.47012.00
5.2.60.0370.37012.00
5.2.50.0000.43712.00
5.2.40.0000.41312.00
5.2.30.0030.49712.07
5.2.20.0000.49012.00
5.2.10.0070.51012.00
5.2.00.0030.50012.00
5.1.60.0070.48012.00
5.1.50.0030.54712.00
5.1.40.0000.54312.00
5.1.30.0070.54312.00
5.1.20.0070.52712.00
5.1.10.0030.39012.00
5.1.00.0070.51312.00
5.0.50.0070.91012.00
5.0.40.0070.91312.00
5.0.30.0030.89012.00
5.0.20.0030.84712.00
5.0.10.0000.91012.00
5.0.00.0030.83312.00
4.4.90.0000.87012.00
4.4.80.0030.83012.00
4.4.70.0000.80012.00
4.4.60.0000.84712.00
4.4.50.0030.85312.00
4.4.40.0030.92712.00
4.4.30.0030.89712.00
4.4.20.0070.90312.00
4.4.10.0070.89712.00
4.4.00.0000.77012.00
4.3.110.0000.68712.00
4.3.100.0000.87012.00
4.3.90.0000.79312.00
4.3.80.0030.76012.00
4.3.70.0000.71312.00
4.3.60.0070.89012.00
4.3.50.0000.76712.00
4.3.40.0030.72312.00
4.3.30.0000.90312.00
4.3.20.0070.85012.00
4.3.10.0030.70712.00
4.3.00.0070.91712.00

preferences:
46.04 ms | 401 KiB | 5 Q