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>"; ?>

Abusive script

This script was stopped while abusing our resources

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.0090.01217.50
7.4.130.0120.02416.94
7.4.120.0150.01416.77
7.4.110.0180.01117.00
7.4.100.0300.00617.08
7.4.90.0150.00717.09
7.4.80.0300.01817.32
7.4.70.0250.01317.29
7.4.60.0120.01216.94
7.4.50.0290.01017.38
7.4.40.0190.02217.07
7.4.30.0250.01316.95
7.4.20.0220.01116.98
7.4.10.0180.00416.83
7.4.00.0220.01317.11
7.3.250.0541.23016.88
7.3.240.0161.25417.04
7.3.230.0331.20016.73
7.3.220.0231.50517.11
7.3.210.0201.25017.29
7.3.200.0231.43817.39
7.3.190.0301.19017.23
7.3.180.0361.14517.11
7.3.170.0331.23317.23
7.3.160.0291.24917.32
7.3.150.0361.23916.97
7.3.140.0191.24217.61
7.3.130.0421.25217.22
7.3.120.0271.17417.12
7.3.110.0441.22217.05
7.3.100.0421.38417.02
7.3.90.0351.19017.12
7.3.80.0351.30017.16
7.3.70.0361.65017.20
7.3.60.0451.24517.01
7.3.50.0491.33217.22
7.3.40.0521.16617.30
7.3.30.0261.22516.98
7.3.20.0321.16217.06
7.3.10.0201.20617.15
7.3.00.0161.20816.88
7.2.340.0391.42417.11
7.2.330.0331.43917.40
7.2.320.0391.68717.28
7.2.310.0221.36017.38
7.2.300.0521.30517.35
7.2.290.0221.36817.53
7.2.280.0421.41017.54
7.2.270.0411.42617.30
7.2.260.0361.37317.46
7.2.250.0551.43217.36
7.2.240.0531.75117.21
7.2.230.0361.46617.17
7.2.220.0301.41317.45
7.2.210.0521.59817.34
7.2.200.0481.37117.25
7.2.190.0501.43417.34
7.2.180.0431.43017.27
7.2.170.0551.30917.43
7.2.160.0301.34617.22
7.2.150.0391.62517.33
7.2.140.0191.33917.31
7.2.130.0291.36217.31
7.2.120.0571.81217.47
7.2.110.0611.38117.30
7.2.100.0631.45817.36
7.2.90.0711.37617.64
7.2.80.0291.35817.27
7.2.70.0231.35817.31
7.2.60.0971.34316.54
7.2.50.1021.42116.48
7.2.40.1001.50016.81
7.2.30.1021.38316.59
7.2.20.0861.32216.76
7.2.10.0971.66616.71
7.2.00.0371.40618.08
7.1.330.0681.94116.25
7.1.320.0381.66616.41
7.1.310.0261.69916.25
7.1.300.0811.69016.43
7.1.290.0561.73716.30
7.1.280.0321.69416.23
7.1.270.1131.72616.23
7.1.260.0681.74616.29
7.1.250.0161.72216.33
7.1.240.0591.73916.37
7.1.230.0551.74316.33
7.1.220.0551.68216.40
7.1.210.0511.76616.25
7.1.200.0201.64816.22
7.1.190.0261.72816.10
7.1.180.0531.73916.45
7.1.170.1161.79315.50
7.1.160.0831.72216.84
7.1.150.0981.67617.03
7.1.140.0981.78917.04
7.1.130.1361.84416.87
7.1.120.0971.81616.87
7.1.110.1271.82216.44
7.1.100.0981.81316.62
7.1.90.1081.89716.65
7.1.80.1251.62316.62
7.1.70.0591.59916.81
7.1.60.1011.51823.42
7.1.50.0851.47122.64
7.1.40.1211.83525.00
7.1.30.1161.90024.96
7.1.20.1371.82025.07
7.1.00.0101.12723.21
7.0.330.0361.67715.95
7.0.320.0261.78015.71
7.0.310.0291.65515.74
7.0.300.1181.76515.05
7.0.290.1241.73516.71
7.0.280.0361.65116.02
7.0.270.0921.88916.76
7.0.260.1421.81616.70
7.0.250.1151.73216.54
7.0.240.1671.68616.48
7.0.230.0901.69816.52
7.0.220.0891.63216.43
7.0.210.0241.84415.86
7.0.200.0781.53916.56
7.0.190.1041.67915.83
7.0.180.1321.79615.53
7.0.170.1101.79015.64
7.0.160.1311.70415.70
7.0.140.0071.26022.51
7.0.100.0001.00720.68
7.0.90.0031.04320.69
7.0.80.0001.00720.65
7.0.70.0100.92720.65
7.0.60.0301.07720.53
7.0.50.0171.15721.04
7.0.40.0070.96720.66
7.0.30.0031.06720.79
7.0.20.0100.97020.72
7.0.10.1071.01320.68
7.0.00.0171.00720.75
5.6.400.0291.96317.20
5.6.390.0331.96217.24
5.6.380.0291.96517.08
5.6.370.0641.93716.93
5.6.360.0621.90616.96
5.6.350.0251.96916.79
5.6.340.0681.94617.30
5.6.330.0421.95317.01
5.6.320.0331.96516.94
5.6.310.0671.74717.20
5.6.300.0262.42321.50
5.6.280.0002.50022.32
5.6.250.0032.40021.53
5.6.240.0032.49721.82
5.6.230.0102.49021.77
5.6.220.0032.49721.76
5.6.210.0032.46721.74
5.6.200.0132.48722.20
5.6.190.0102.48322.30
5.6.180.0102.49022.30
5.6.170.0032.49722.29
5.6.160.0132.48722.10
5.6.150.0132.48722.11
5.6.140.0032.49022.11
5.6.130.0102.49022.16
5.6.120.0072.49322.26
5.6.110.0032.49722.12
5.6.100.0072.47322.27
5.6.90.0032.49722.17
5.6.80.2772.20721.60
5.6.70.0032.49721.53
5.6.60.0132.48721.63
5.6.50.0002.50021.56
5.6.40.0102.49021.50
5.6.30.0102.40721.60
5.6.20.0072.49321.64
5.6.10.0072.49321.51
5.6.00.0032.49721.50
5.5.380.0102.49021.67
5.5.370.0032.49721.54
5.5.360.0172.48321.52
5.5.350.0132.48721.57
5.5.340.0072.48021.98
5.5.330.0032.49722.08
5.5.320.0032.49721.96
5.5.310.0032.49721.82
5.5.300.0102.47022.07
5.5.290.1032.39721.92
5.5.280.0202.48022.05
5.5.270.0072.44021.90
5.5.260.0102.36021.99
5.5.250.0132.46721.84
5.5.240.0072.47721.32
5.5.230.0172.48321.35
5.5.220.0002.50021.42
5.5.210.0072.49321.21
5.5.200.0132.48721.19
5.5.190.0072.46721.24
5.5.180.0102.36721.30
5.5.160.0172.48321.24
5.5.150.0072.49321.32
5.5.140.0072.49321.24
5.5.130.0002.48321.35
5.5.120.0032.49721.27
5.5.110.0202.40321.31
5.5.100.0132.48721.22
5.5.90.0102.45021.12
5.5.80.0002.50021.28
5.5.70.0172.43021.29
5.5.60.0102.49021.10
5.5.50.0072.47321.28
5.5.40.0072.49321.34
5.5.30.0072.49321.20
5.5.20.0102.49021.16
5.5.10.0072.49321.20
5.5.00.0102.49021.16
5.4.450.0072.49320.50
5.4.440.0072.49320.31
5.4.430.0072.49320.40
5.4.420.0172.48320.42
5.4.410.0072.49320.28
5.4.400.0072.49320.07
5.4.390.0072.49320.25
5.4.380.0102.49020.00
5.4.370.0072.49320.05
5.4.360.0102.49020.14
5.4.350.0002.50020.25
5.4.340.0032.49720.04
5.4.320.0002.50019.97
5.4.310.0102.49020.04
5.4.300.0102.49020.04
5.4.290.0102.49020.16
5.4.280.0072.49320.04
5.4.270.0032.47319.95
5.4.260.0132.48720.05
5.4.250.0072.49320.02
5.4.240.0032.38019.98
5.4.230.0002.50020.14
5.4.220.0072.49319.99
5.4.210.0032.49720.20
5.4.200.0102.49019.96
5.4.190.0072.49320.20
5.4.180.0072.49320.09
5.4.170.0102.49019.98
5.4.160.0032.49720.03
5.4.150.0002.39319.84
5.4.140.0032.49717.38
5.4.130.0132.48717.44
5.4.120.0072.49317.45
5.4.110.0072.49317.52
5.4.100.0032.49717.51
5.4.90.0072.49317.51
5.4.80.0002.50017.51
5.4.70.0032.38017.39
5.4.60.0102.49017.32
5.4.50.0032.49717.43
5.4.40.0032.49717.60
5.4.30.1632.33317.40
5.4.20.0072.43717.31
5.4.10.0072.49317.36
5.4.00.0072.49316.73
5.3.290.0102.49015.62
5.3.280.0102.49015.56
5.3.270.0132.48715.54
5.3.260.2272.27315.56
5.3.250.0102.49015.63
5.3.240.0032.49715.58
5.3.230.0132.48715.59
5.3.220.0072.49315.53
5.3.210.0002.50015.49
5.3.200.0232.47715.50
5.3.190.0032.49715.48
5.3.180.0172.48315.54
5.3.170.0032.49715.58
5.3.160.0032.49715.63
5.3.150.0102.49015.57
5.3.140.0072.49315.53
5.3.130.0172.48315.58
5.3.120.0002.50015.53
5.3.110.0032.49715.57
5.3.100.0002.50015.03
5.3.90.1802.31314.94
5.3.80.0002.50014.86
5.3.70.0072.47314.91
5.3.60.0102.49014.89
5.3.50.0072.49314.84
5.3.40.0132.48714.89
5.3.30.0132.48714.84
5.3.20.0002.50014.84
5.3.10.0072.49314.84
5.3.00.0072.49314.84

preferences:
36.33 ms | 401 KiB | 5 Q