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);} const 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.0060.00917.00
8.0.100.0060.00917.00
8.0.90.0030.01316.81
8.0.80.0070.02116.96
8.0.70.0060.01016.92
8.0.60.0080.00816.88
8.0.50.0060.00916.92
8.0.30.0110.01817.04
8.0.20.0080.01817.40
8.0.10.0000.01617.16
8.0.00.0120.01816.85
7.4.240.0070.00916.59
7.4.230.0000.01516.72
7.4.220.0060.02316.41
7.4.210.0020.02316.59
7.4.200.0000.01516.39
7.4.190.0000.01616.46
7.4.160.0100.01716.53
7.4.150.0030.02317.40
7.4.140.0080.02017.86
7.4.130.0080.02516.56
7.4.120.0070.01916.63
7.4.110.0100.01716.69
7.4.100.0130.02416.64
7.4.90.0090.02616.40
7.4.80.0120.01619.39
7.4.70.0060.02016.31
7.4.60.0160.01216.55
7.4.50.0030.01716.51
7.4.40.0080.01622.77
7.4.30.0100.01616.53
7.4.00.0070.01714.75
7.3.300.0000.01516.41
7.3.290.0090.02516.40
7.3.280.0100.02116.44
7.3.270.0180.00917.40
7.3.260.0120.02816.60
7.3.250.0090.02916.55
7.3.240.0090.02716.33
7.3.230.0100.01916.44
7.3.210.0150.02416.57
7.3.200.0120.01519.39
7.3.190.0120.01816.49
7.3.180.0100.01616.34
7.3.170.0100.02516.55
7.3.160.0070.02116.48
7.3.120.0100.01414.77
7.2.330.0070.02416.78
7.2.320.0070.02216.85
7.2.310.0110.02316.82
7.2.300.0060.02316.43
7.2.290.0030.03016.98
7.1.100.0030.02318.14
7.1.70.0030.01317.34
7.1.60.0130.02819.21
7.1.50.0040.02816.96
7.1.00.0070.05722.43
7.0.200.0100.02014.69
7.0.140.0070.09022.17
7.0.60.0030.06319.98
7.0.50.0100.05717.91
7.0.40.0070.10320.13
7.0.30.0300.08720.07
7.0.20.0370.08020.24
7.0.10.0230.04720.07
7.0.00.0100.08020.10
5.6.280.0000.11321.06
5.6.210.0030.11720.67
5.6.200.0130.11318.18
5.6.190.0100.11320.57
5.6.180.0270.06720.30
5.6.170.0300.08020.51
5.6.160.0000.06720.48
5.6.150.0100.09718.29
5.6.140.0070.06018.18
5.6.130.0100.07018.18
5.6.120.0100.06321.14
5.6.110.0070.12020.91
5.6.100.0170.11321.02
5.6.90.0000.12321.05
5.6.80.0100.07320.43
5.6.70.0400.10320.39
5.5.350.0270.10020.43
5.5.340.0070.08018.09
5.5.330.0100.10320.41
5.5.320.0270.11320.22
5.5.310.0230.08720.36
5.5.300.0130.10718.09
5.5.290.0070.11317.95
5.5.280.0170.10720.82
5.5.270.0100.10020.78
5.5.260.0030.09720.89
5.5.250.0170.10720.71
5.5.240.0130.09320.17
5.4.450.0800.13319.56
5.4.440.1230.09319.38
5.4.430.0770.12319.31
5.4.420.1330.12719.57
5.4.410.0130.08318.97
5.4.400.0530.08718.89
5.4.390.0470.11318.81
5.4.380.0270.08718.79
5.4.370.0200.08018.76
5.4.360.0130.08718.79
5.4.350.0150.10612.04
5.4.340.0040.06212.03
5.4.320.0080.06612.53
5.4.310.0070.07412.52
5.4.300.0090.06712.53
5.4.290.0090.06612.52
5.4.280.0080.09612.39
5.4.270.0080.07212.39
5.4.260.0080.09112.39
5.4.250.0060.06612.39
5.4.240.0060.07112.39
5.4.230.0090.07112.39
5.4.220.0120.07212.38
5.4.210.0100.08612.39
5.4.200.0070.06912.38
5.4.190.0120.08112.38
5.4.180.0080.07312.38
5.4.170.0070.07412.39
5.4.160.0090.06712.38
5.4.150.0060.06512.38
5.4.140.0060.06612.06
5.4.130.0080.06712.05
5.4.120.0050.06912.01
5.4.110.0090.06412.00
5.4.100.0130.07212.00
5.4.90.0080.06712.00
5.4.80.0050.06512.01
5.4.70.0100.06512.00
5.4.60.0060.06312.00
5.4.50.0080.07412.00
5.4.40.0090.06611.99
5.4.30.0080.06711.98
5.4.20.0050.07011.98
5.4.10.0080.07211.98
5.4.00.0080.09311.47
5.3.290.0080.09412.80
5.3.280.0090.13312.71
5.3.270.0100.14712.73
5.3.260.0090.09912.72
5.3.250.0070.10112.72
5.3.240.0090.09412.72
5.3.230.0080.10012.71
5.3.220.0090.10812.68
5.3.210.0050.12212.68
5.3.200.0070.09112.68
5.3.190.0170.14812.68
5.3.180.0140.13712.67
5.3.170.0090.08812.67
5.3.160.0080.09012.67
5.3.150.0100.09012.68
5.3.140.0070.08712.66
5.3.130.0090.08612.66
5.3.120.0110.08512.66
5.3.110.0050.09312.65
5.3.100.0090.10012.12
5.3.90.0060.10512.10
5.3.80.0090.09812.09
5.3.70.0090.08412.09
5.3.60.0120.09712.07
5.3.50.0160.14012.03
5.3.40.0090.10012.03
5.3.30.0080.08511.99
5.3.20.0130.11311.77
5.3.10.0090.08111.73
5.3.00.0040.09311.71
5.2.170.0050.0329.22
5.2.160.0030.0319.21
5.2.150.0070.0309.22
5.2.140.0060.0309.21
5.2.130.0080.0279.17
5.2.120.0040.0319.17
5.2.110.0070.0279.18
5.2.100.0050.0299.18
5.2.90.0070.0329.18
5.2.80.0080.0289.18
5.2.70.0070.0319.17
5.2.60.0050.0359.13
5.2.50.0090.0289.10
5.2.40.0040.0339.08
5.2.30.0130.0419.05
5.2.20.0060.0389.04
5.2.10.0070.0388.95
5.2.00.0060.0418.82
5.1.60.0050.0348.10
5.1.50.0090.0318.11
5.1.40.0050.0278.08
5.1.30.0080.0328.42
5.1.20.0060.0358.45
5.1.10.0080.0238.18
5.1.00.0060.0268.18
5.0.50.0070.0196.65
5.0.40.0030.0226.52
5.0.30.0060.0326.33
5.0.20.0060.0246.29
5.0.10.0050.0196.28
5.0.00.0050.0396.27
4.4.90.0040.0194.78
4.4.80.0120.0164.75
4.4.70.0070.0234.75
4.4.60.0100.0174.75
4.4.50.0050.0184.77
4.4.40.0060.0274.71
4.4.30.0030.0164.76
4.4.20.0070.0164.84
4.4.10.0030.0184.85
4.4.00.0050.0324.75
4.3.110.0050.0174.67
4.3.100.0070.0154.67
4.3.90.0070.0174.64
4.3.80.0090.0284.59
4.3.70.0050.0174.63
4.3.60.0050.0134.63
4.3.50.0030.0184.63
4.3.40.0080.0294.54
4.3.30.0050.0203.33
4.3.20.0010.0223.30
4.3.10.0010.0193.27
4.3.00.0100.0306.88

preferences:
36.74 ms | 401 KiB | 5 Q