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 = 140) { $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 = 130) { $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 = 19000) { $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 = 9000) { $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.0090.00915.84
7.3.110.0030.01315.78
7.3.100.0060.01215.99
7.3.90.0100.00715.98
7.3.80.0090.00616.02
7.3.70.0100.00616.07
7.3.60.0070.01015.99
7.3.50.0070.00715.98
7.3.40.0080.00415.61
7.3.30.0000.01215.97
7.3.20.0040.01117.55
7.3.10.0090.00617.75
7.3.00.0170.01017.59
7.2.240.0030.00916.30
7.2.230.0100.00316.07
7.2.220.0100.00716.11
7.2.210.0130.00616.14
7.2.200.0070.01316.13
7.2.190.0060.00615.93
7.2.180.0070.01116.08
7.2.170.0060.01015.89
7.2.160.0030.01316.13
7.2.150.0070.00718.10
7.2.140.0000.01317.93
7.2.130.0040.00817.60
7.2.120.0050.01017.84
7.2.110.0060.00617.54
7.2.100.0100.00617.83
7.2.90.0030.01017.82
7.2.80.0000.01117.95
7.2.70.0100.01017.95
7.2.60.0040.01117.89
7.2.50.0000.01317.52
7.2.40.0160.01017.91
7.2.30.0090.00617.90
7.2.20.0100.00317.90
7.2.10.0060.00917.85
7.2.00.0030.01119.31
7.1.330.0030.00716.78
7.1.320.0000.02116.91
7.1.310.0030.01416.87
7.1.300.0070.01116.77
7.1.290.0100.00716.66
7.1.280.0090.00916.64
7.1.270.0030.01316.80
7.1.260.0000.01116.56
7.1.250.0000.01616.41
7.1.70.0080.00318.37
7.1.60.0140.01419.17
7.1.50.0170.01017.96
7.1.00.0000.03723.14
7.0.200.0000.01117.51
7.0.140.0070.07022.66
7.0.100.0130.05720.65
7.0.90.0000.05020.63
7.0.80.0030.06720.57
7.0.70.0100.08320.61
7.0.60.0100.07020.50
7.0.50.0130.07320.90
7.0.40.0030.06720.73
7.0.30.0030.07720.66
7.0.20.0070.08320.64
7.0.10.0000.09020.69
7.0.00.0070.05020.68
5.6.280.0030.08021.96
5.6.250.0070.05021.43
5.6.240.0170.04721.36
5.6.230.0000.07021.44
5.6.220.0130.08021.45
5.6.210.0130.04321.45
5.6.200.0070.04321.80
5.6.190.0100.05721.75
5.6.180.0030.07321.70
5.6.170.0070.09321.71
5.6.160.0130.05721.64
5.6.150.0170.07721.67
5.6.140.0170.07321.71
5.6.130.0000.09721.76
5.6.120.0070.05321.59
5.6.110.0100.07721.67
5.6.100.0030.05721.64
5.6.90.0130.07721.66
5.6.80.0070.07321.26
5.6.70.0170.07721.14
5.6.60.0030.07721.32
5.6.50.0130.07021.13
5.6.40.0100.08321.18
5.6.30.0100.08020.96
5.6.20.0100.08021.02
5.6.10.0070.04721.08
5.6.00.0030.08021.07
5.5.380.0100.04321.32
5.5.370.0070.08021.36
5.5.360.0100.08021.27
5.5.350.0070.05721.26
5.5.340.0100.07321.60
5.5.330.0030.05321.42
5.5.320.0070.09021.59
5.5.310.0070.07721.51
5.5.300.0130.07721.56
5.5.290.0070.08021.57
5.5.280.0070.04321.48
5.5.270.0000.05321.54
5.5.260.0030.08721.51
5.5.250.0070.05721.32
5.5.240.0070.08020.72
5.5.230.0130.07720.71
5.5.220.0130.07020.89
5.5.210.0130.05720.95
5.5.200.0100.07020.77
5.5.190.0100.08320.90
5.5.180.0070.05320.81
5.5.160.0070.08320.95
5.5.150.0200.07320.92
5.5.140.0000.08320.96
5.5.130.0100.07020.95
5.5.120.0130.04320.89
5.5.110.0030.09320.86
5.5.100.0000.09020.74
5.5.90.0070.08720.73
5.5.80.0100.05020.79
5.5.70.0070.04720.63
5.5.60.0000.05020.65
5.5.50.0070.04720.71
5.5.40.0030.05020.65
5.5.30.0000.05020.77
5.5.20.0030.04720.74
5.5.10.0030.05020.78
5.5.00.0030.07320.68
5.4.450.0000.04720.29
5.4.440.0030.05720.03
5.4.430.0200.06020.15
5.4.420.0070.05320.11
5.4.410.0100.05720.14
5.4.400.0100.07719.70
5.4.390.0030.08719.76
5.4.380.0100.03719.70
5.4.370.0000.09019.75
5.4.360.0000.08319.77
5.4.350.0070.08019.67
5.4.340.0100.08019.90
5.4.320.0070.08319.74
5.4.310.0100.08319.70
5.4.300.0070.07019.91
5.4.290.0100.08019.77
5.4.280.0170.07319.90
5.4.270.0030.05019.78
5.4.260.0070.05719.70
5.4.250.0070.04719.77
5.4.240.0000.09319.77
5.4.230.0130.07319.75
5.4.220.0030.05019.69
5.4.210.0070.04319.78
5.4.200.0130.04719.63
5.4.190.0030.04719.74
5.4.180.0030.04719.72
5.4.170.0000.04019.67
5.4.160.0070.03319.67
5.4.150.0000.04319.68
5.4.140.0070.03317.00
5.4.130.0030.03716.96
5.4.120.0000.04316.88
5.4.110.0070.08017.07
5.4.100.0030.07316.88
5.4.90.0100.06017.13
5.4.80.0070.04316.86
5.4.70.0100.03716.95
5.4.60.0030.04016.80
5.4.50.0000.04017.02
5.4.40.0030.04016.86
5.4.30.0000.04316.93
5.4.20.0100.03017.04
5.4.10.0070.03716.95
5.4.00.0000.04016.60
5.3.290.0070.08315.45
5.3.280.0030.04715.34
5.3.270.0000.08315.32
5.3.260.0000.04015.34
5.3.250.0030.08015.36
5.3.240.0000.04015.41
5.3.230.0070.06715.43
5.3.220.0030.03715.29
5.3.210.0030.04315.39
5.3.200.0030.08015.31
5.3.190.0030.04315.39
5.3.180.0000.04315.35
5.3.170.0030.08315.43
5.3.160.0030.04015.35
5.3.150.0000.05015.39
5.3.140.0030.05015.29
5.3.130.0000.04315.41
5.3.120.0100.04315.28
5.3.110.0030.04015.34
5.3.100.0000.04314.87
5.3.90.0030.05314.75
5.3.80.0000.04314.73
5.3.70.0000.04314.73
5.3.60.0000.04314.69
5.3.50.0070.03314.57
5.3.40.0000.05014.78
5.3.30.0000.04014.71
5.3.20.0070.04714.50
5.3.10.0070.04314.32
5.3.00.0000.04314.32
5.2.170.0100.03311.91
5.2.160.0000.03311.95
5.2.150.0030.03311.83
5.2.140.0000.03711.91
5.2.130.0030.03311.82
5.2.120.0000.03711.82
5.2.110.0030.03311.88
5.2.100.0000.04011.88
5.2.90.0000.05311.81
5.2.80.0000.04011.77
5.2.70.0000.03711.77
5.2.60.0030.03311.82
5.2.50.0000.03711.68
5.2.40.0070.02711.77
5.2.30.0030.04311.76
5.2.20.0000.03311.73
5.2.10.0000.03011.58
5.2.00.0030.05011.35
5.1.60.0070.02710.65
5.1.50.0000.03310.64
5.1.40.0030.03010.71
5.1.30.0000.03311.06
5.1.20.0000.03311.20
5.1.10.0000.03310.79
5.1.00.0000.03010.91
5.0.50.0000.03010.39
5.0.40.0000.03010.39
5.0.30.0000.04010.39
5.0.20.0070.02310.39
5.0.10.0000.03010.39
5.0.00.0000.03710.39
4.4.90.0000.02310.39
4.4.80.0030.02010.39
4.4.70.0000.02310.39
4.4.60.0030.02310.39
4.4.50.0030.02010.39
4.4.40.0000.03010.39
4.4.30.0030.02010.39
4.4.20.0030.02010.39
4.4.10.0000.02310.39
4.4.00.0000.03310.39
4.3.110.0000.02710.39
4.3.100.0030.02010.39
4.3.90.0030.02010.39
4.3.80.0030.03310.39
4.3.70.0030.02710.39
4.3.60.0000.03710.39
4.3.50.0000.02310.39
4.3.40.0030.02710.39
4.3.30.0000.02710.39
4.3.20.0000.03010.39
4.3.10.0000.03010.39
4.3.00.0030.02310.39

preferences:
34.91 ms | 400 KiB | 5 Q