3v4l.org

run code in 300+ PHP versions simultaneously
<?php //https://github.com/php/php-src/blob/master/Zend/micro_bench.php function hallo() {} function hallo2() {} function simpleucall($n) { for ($i = 0; $i < $n; $i++) hallo(); } function simpleudcall($n) { for ($i = 0; $i < $n; $i++) hallo2(); } function simpleicall($n) { for ($i = 0; $i < $n; $i++) func_num_args(); } define('TEST', null); function read_const($n) { for ($i = 0; $i < $n; ++$i) $x = TEST; } function read_auto_global($n) { for ($i = 0; $i < $n; ++$i) $x = $_GET; } $g_var = 0; function read_global_var($n) { for ($i = 0; $i < $n; ++$i) $x = $GLOBALS['g_var']; } function read_hash($n) { $hash = array('test' => 0); for ($i = 0; $i < $n; ++$i) $x = $hash['test'];} function read_str_offset($n) { $str = "test"; for ($i = 0; $i < $n; ++$i) $x = $str[1]; } function ternary($n) { $val = array(0,1,2,3,4,5,6,7,8,9); $f = false; for ($i = 0; $i < $n; ++$i) $x = $f ? null : $val; } function ternary2($n) { $f = false; $j = 0; for ($i = 0; $i < $n; ++$i) $x = $f ? $f : $j + 1; } /*****/ function getmicrotime() { $t = gettimeofday(); return ($t['sec'] + $t['usec'] / 1000000);} define("N", 50000); simpleucall(N); simpleudcall(N); simpleicall(N); read_const(N); read_auto_global(N); read_global_var(N); read_hash(N); read_str_offset(N); ternary(N); ternary2(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)
8.0.110.0030.01316.96
8.0.100.0060.00916.84
8.0.90.0030.01216.97
8.0.80.0100.02116.85
8.0.70.0040.01117.04
8.0.60.0070.01116.72
8.0.50.0000.01516.83
8.0.30.0120.01217.07
8.0.20.0110.02116.99
8.0.10.0030.01317.17
8.0.00.0100.02516.81
7.4.240.0060.00916.53
7.4.230.0030.01216.36
7.4.220.0190.01516.41
7.4.210.0090.01816.62
7.4.200.0070.01016.66
7.4.190.0030.01416.58
7.4.160.0090.01616.41
7.4.150.0140.01416.50
7.4.140.0100.01616.43
7.4.130.0030.02316.51
7.4.120.0100.02116.48
7.4.110.0090.01916.46
7.4.100.0050.02316.52
7.4.90.0090.01816.51
7.4.80.0090.01916.59
7.4.70.0060.02616.62
7.4.60.0040.02216.55
7.4.50.0000.01416.57
7.4.40.0030.02116.58
7.4.30.0190.01516.68
7.4.00.0060.02114.73
7.3.300.0030.01316.32
7.3.290.0060.02616.40
7.3.280.0060.02616.41
7.3.270.0140.01416.77
7.3.260.0100.02016.45
7.3.250.0110.01916.64
7.3.240.0130.02616.59
7.3.230.0060.02216.46
7.3.210.0100.01916.55
7.3.200.0140.01519.39
7.3.190.0130.01616.59
7.3.180.0090.03016.49
7.3.170.0060.02016.64
7.3.160.0130.01316.54
7.3.120.0060.01914.88
7.2.330.0070.02316.60
7.2.320.0030.03916.55
7.2.310.0130.02316.70
7.2.300.0030.03216.60
7.2.290.0030.02616.54
7.2.00.0030.01719.23
7.1.100.0000.02218.06
7.1.70.0070.01017.20
7.1.60.0130.03319.31
7.1.50.0100.03217.07
7.1.00.0030.05722.30
7.0.200.0090.00916.69
7.0.140.0030.09021.95
7.0.120.0070.06022.03
7.0.60.0170.08719.97
7.0.50.0070.07717.90
7.0.40.0030.06017.80
7.0.30.0130.04717.84
7.0.20.0100.07317.71
7.0.10.0100.08717.67
7.0.00.0000.10017.68
5.6.280.0030.10721.01
5.6.210.0100.10020.47
5.6.200.0030.06018.15
5.6.190.0100.05718.24
5.6.180.0000.08718.18
5.6.170.0030.07718.25
5.6.160.0130.08018.16
5.6.150.0070.08018.15
5.6.140.0130.10718.19
5.6.130.0130.11318.14
5.6.120.0130.07018.16
5.6.110.0070.10318.23
5.6.100.0100.06318.26
5.6.90.0070.11318.17
5.6.80.0100.10717.54
5.6.70.0030.11317.57
5.6.60.0100.10717.67
5.6.50.0200.09717.68
5.6.40.0100.10717.61
5.6.30.0030.11017.54
5.6.20.0000.06717.62
5.6.10.0170.10317.54
5.6.00.0030.10017.59
5.5.350.0330.10020.32
5.5.340.0030.06018.02
5.5.330.0070.11017.98
5.5.320.0170.09717.94
5.5.310.0070.11318.02
5.5.300.0100.10018.05
5.5.290.0100.06017.98
5.5.280.0070.06317.97
5.5.270.0070.08017.95
5.5.260.0100.07717.97
5.5.250.0030.10317.86
5.5.240.0030.11317.45
5.5.230.0070.10717.31
5.5.220.0070.11017.34
5.5.210.0070.08317.36
5.5.200.0170.10717.31
5.5.190.0030.08017.38
5.5.180.0070.06717.40
5.5.160.0100.09717.45
5.5.150.0100.09717.29
5.5.140.0100.07017.31
5.5.130.0100.10317.34
5.5.120.0070.11017.29
5.5.110.0100.06017.32
5.5.100.0000.08017.27
5.5.90.0030.11317.33
5.5.80.0100.10717.34
5.5.70.0030.09717.20
5.5.60.0200.08017.18
5.5.50.0070.06017.18
5.5.40.0030.06017.21
5.5.30.0100.09717.27
5.5.20.0070.11017.23
5.5.10.0130.09317.25
5.5.00.0100.11017.32
5.4.450.0100.10319.38
5.4.440.0030.09019.38
5.4.430.0100.10319.44
5.4.420.0070.06319.21
5.4.410.0130.05319.47
5.4.400.0070.07319.14
5.4.390.0130.10019.14
5.4.380.0170.05019.06
5.4.370.0100.10719.10
5.4.360.0030.11319.05
5.4.350.0030.11019.05
5.4.340.0100.08019.09
5.4.320.0000.10019.13
5.4.310.0070.11319.12
5.4.300.0030.11319.01
5.4.290.0100.11019.05
5.4.280.0130.07719.02
5.4.270.0030.10319.10
5.4.260.0000.09019.10
5.4.250.0070.10319.06
5.4.240.0000.10719.08
5.4.230.0000.10719.17
5.4.220.0070.06319.07
5.4.210.0130.11018.98
5.4.200.0030.10719.05
5.4.190.0130.10719.04
5.4.180.0070.10018.96
5.4.170.0030.06319.13
5.4.160.0000.11019.03
5.4.150.0030.10319.02
5.4.140.0070.08316.48
5.4.130.0030.11316.51
5.4.120.0070.07016.54
5.4.110.0070.09316.37
5.4.100.0070.10716.41
5.4.90.0070.10016.46
5.4.80.0030.08316.34
5.4.70.0070.11016.49
5.4.60.0170.09716.34
5.4.50.0000.09716.67
5.4.40.0030.07316.41
5.4.30.0100.10316.61
5.4.20.0070.09716.26
5.4.10.0100.11016.57
5.4.00.0200.09015.80
5.3.290.0130.12314.55
5.3.280.0030.08714.66
5.3.270.0030.14714.63
5.3.260.0030.12714.69
5.3.250.0030.14314.63
5.3.240.0100.13314.66
5.3.230.0070.14714.66
5.3.220.0070.13314.61
5.3.210.0070.10014.60
5.3.200.0030.09714.67
5.3.190.0030.14714.65
5.3.180.0100.11714.81
5.3.170.0030.14014.81
5.3.160.0000.09014.56
5.3.150.0030.12014.61
5.3.140.0170.12314.66
5.3.130.0030.14314.59
5.3.120.0070.14314.65
5.3.110.0030.11314.54
5.3.100.0000.13313.91
5.3.90.0070.13314.10
5.3.80.0100.14014.09
5.3.70.0070.11314.08
5.3.60.0030.12014.01
5.3.50.0030.08714.02
5.3.40.0030.08313.96
5.3.30.0000.10014.00
5.3.20.0030.10713.93
5.3.10.0070.14013.77
5.3.00.0070.08713.70
5.2.170.0000.09711.21
5.2.160.0030.10011.17
5.2.150.0000.11011.25
5.2.140.0070.08711.20
5.2.130.0030.13711.13
5.2.120.0030.14711.02
5.2.110.0130.08311.14
5.2.100.0070.11011.12
5.2.90.0030.10711.05
5.2.80.0000.09011.02
5.2.70.0000.09011.01
5.2.60.0000.10011.12
5.2.50.0070.09311.02
5.2.40.0030.15011.02
5.2.30.0070.09710.90
5.2.20.0000.10311.04
5.2.10.0070.08310.95
5.2.00.0070.13310.65
5.1.60.0070.1079.94
5.1.50.0070.08310.02
5.1.40.0030.0909.99
5.1.30.0030.08710.35
5.1.20.0070.14310.23
5.1.10.0070.09310.14
5.1.00.0070.1239.93
5.0.50.0030.1639.21
5.0.40.0000.1439.21
5.0.30.0300.1739.21
5.0.20.0000.1739.21
5.0.10.0070.1679.21
5.0.00.0030.1439.21
4.4.90.0030.1239.21
4.4.80.0000.1279.21
4.4.70.0030.1809.21
4.4.60.0070.1979.21
4.4.50.0070.1709.21
4.4.40.0000.1709.21
4.4.30.0000.1379.21
4.4.20.0000.1639.21
4.4.10.0000.1309.21
4.4.00.0030.1339.21
4.3.110.0000.1909.21
4.3.100.0100.1839.21
4.3.90.0030.1579.21
4.3.80.0000.1579.21
4.3.70.0070.1879.21
4.3.60.0070.1709.21
4.3.50.0030.1609.21
4.3.40.0000.1379.21
4.3.30.0030.1879.21
4.3.20.0430.1139.21
4.3.10.0000.1839.21
4.3.00.0000.1309.21

preferences:
49.5 ms | 400 KiB | 5 Q