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); issetor(N); issetor2(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.0000.01416.92
8.0.100.0030.01016.80
8.0.90.0000.01416.95
8.0.80.0030.01916.91
8.0.70.0070.00716.84
8.0.60.0070.00716.99
8.0.50.0080.00617.04
8.0.30.0080.01817.21
8.0.20.0100.01917.40
8.0.10.0030.01016.89
8.0.00.0080.02016.99
7.4.240.0000.01416.61
7.4.230.0030.01016.46
7.4.220.0070.00716.73
7.4.210.0100.01216.54
7.4.200.0040.01116.68
7.4.190.0000.01416.83
7.4.160.0090.01516.54
7.4.150.0160.01017.40
7.4.140.0090.02617.86
7.4.130.0080.01716.54
7.4.120.0080.01616.51
7.4.110.0190.02516.54
7.4.100.0000.02616.61
7.4.90.0160.01316.64
7.4.80.0030.03419.39
7.4.70.0110.01416.66
7.4.60.0110.01416.44
7.4.50.0000.01016.39
7.4.40.0070.01722.77
7.4.30.0110.01816.65
7.4.00.0030.01915.23
7.3.300.0040.01116.47
7.3.290.0090.01316.41
7.3.280.0140.01816.44
7.3.270.0140.01417.40
7.3.260.0100.01716.65
7.3.250.0100.02116.53
7.3.240.0130.01616.36
7.3.230.0040.02216.50
7.3.210.0070.02016.54
7.3.200.0080.02919.39
7.3.190.0180.01916.66
7.3.180.0060.01816.62
7.3.170.0030.02216.62
7.3.160.0070.01716.49
7.3.120.0060.01614.71
7.2.330.0030.02616.86
7.2.320.0100.01916.75
7.2.310.0100.01716.53
7.2.300.0120.02516.58
7.2.290.0030.02316.83
7.2.60.0080.01217.00
7.1.200.0100.01315.77
7.1.70.0000.01517.18
7.1.60.0060.01517.25
7.1.50.0200.02934.79
7.1.00.0030.08722.32
7.0.200.0030.02916.65
7.0.140.0000.09321.93
7.0.60.0170.08019.82
7.0.50.0000.06017.91
7.0.40.0030.10020.11
7.0.30.0200.05320.10
7.0.20.0230.08720.24
7.0.10.0300.09720.25
7.0.00.0030.10320.25
5.6.280.0000.10321.07
5.6.210.0070.10320.59
5.6.200.0070.08718.17
5.6.190.0030.06320.32
5.6.180.0200.08720.55
5.6.170.0270.10320.52
5.6.160.0100.09020.45
5.6.150.0130.10718.16
5.6.140.0070.06018.19
5.6.130.0000.06018.18
5.6.120.0030.06021.15
5.6.110.0000.06021.09
5.6.100.0030.06321.00
5.6.90.0030.11021.00
5.6.80.0100.08720.46
5.6.70.0200.05720.40
5.5.350.0070.10320.32
5.5.340.0000.08018.09
5.5.330.0070.07720.48
5.5.320.0230.08320.20
5.5.310.0400.09720.35
5.5.300.0170.10018.09
5.5.290.0030.10317.94
5.5.280.0100.06320.86
5.5.270.0000.07320.91
5.5.260.0070.05720.91
5.5.250.0000.06320.60
5.5.240.0000.08720.29
5.4.450.0070.07719.50
5.4.440.0000.08019.48
5.4.430.0000.08319.57
5.4.420.0070.08319.55
5.4.410.0030.07319.05
5.4.400.0100.09019.23
5.4.390.0070.08719.16
5.4.380.0070.10019.00
5.4.370.0100.06718.98
5.4.360.0070.08718.98
5.4.350.0000.10319.09
5.4.340.0000.08319.32
5.4.320.0100.08719.22
5.4.310.0000.09018.86
5.4.300.0070.05318.86
5.4.290.0130.09719.13
5.4.280.0000.10718.95
5.4.270.0030.10719.20
5.4.260.0170.08719.31
5.4.250.0030.06019.21
5.4.240.0000.07019.22
5.4.230.0000.10719.24
5.4.220.0070.08718.99
5.4.210.0000.06018.98
5.4.200.0070.06319.15
5.4.190.0000.06318.84
5.4.180.0030.10319.14
5.4.170.0070.07318.93
5.4.160.0100.09018.83
5.4.150.0070.10019.23
5.4.140.0030.10016.57
5.4.130.0000.07316.55
5.4.120.0030.06316.37
5.4.110.0070.10716.31
5.4.100.0000.05316.63
5.4.90.0000.07316.51
5.4.80.0030.10316.55
5.4.70.0070.06316.44
5.4.60.0070.09316.58
5.4.50.0030.06016.58
5.4.40.0030.05716.58
5.4.30.0070.09316.42
5.4.20.0030.10316.43
5.4.10.0000.06316.58
5.4.00.0030.10315.88
5.3.290.0030.10314.77
5.3.280.0030.07314.78
5.3.270.0000.08714.64
5.3.260.0030.08714.54
5.3.250.0070.09714.71
5.3.240.0030.11014.61
5.3.230.0000.11714.68
5.3.220.0100.11014.52
5.3.210.0070.07714.52
5.3.200.0000.08014.60
5.3.190.0230.05714.71
5.3.180.0070.11314.59
5.3.170.0000.09714.52
5.3.160.0030.08314.59
5.3.150.0030.07714.50
5.3.140.0070.09314.70
5.3.130.0030.06714.80
5.3.120.0100.08314.69
5.3.110.0030.10014.66
5.3.100.0070.10314.04
5.3.90.0000.10314.14
5.3.80.0070.11714.12
5.3.70.0030.07013.95
5.3.60.0000.11314.25
5.3.50.0070.10313.91
5.3.40.0070.11313.88
5.3.30.0030.11713.91
5.3.20.0100.10313.74
5.3.10.0000.10313.75
5.3.00.0000.08713.58
5.2.170.0000.03712.07
5.2.160.0030.06312.07
5.2.150.0030.03012.07
5.2.140.0030.04012.07
5.2.130.0030.06012.07
5.2.120.0000.03712.07
5.2.110.0030.06312.07
5.2.100.0030.03712.07
5.2.90.0000.06012.07
5.2.80.0000.06712.07
5.2.70.0000.04012.07
5.2.60.0030.05012.07
5.2.50.0030.04712.07
5.2.40.0030.05712.07
5.2.30.0030.03712.07
5.2.20.0100.05312.07
5.2.10.0000.03312.07
5.2.00.0030.03312.07
5.1.60.0000.02712.07
5.1.50.0000.02712.07
5.1.40.0030.03312.07
5.1.30.0000.06012.07
5.1.20.0000.05712.07
5.1.10.0030.05312.07
5.1.00.0000.05312.07
5.0.50.0000.05012.07
5.0.40.0000.04712.07
5.0.30.0070.06312.07
5.0.20.0000.03012.07
5.0.10.0030.03012.07
5.0.00.0000.05712.07
4.4.90.0000.03312.07
4.4.80.0000.02712.07
4.4.70.0000.03712.07
4.4.60.0000.02312.07
4.4.50.0000.02012.07
4.4.40.0070.03012.07
4.4.30.0000.01712.07
4.4.20.0000.03712.07
4.4.10.0030.01712.07
4.4.00.0030.04012.07
4.3.110.0000.02312.07
4.3.100.0000.03312.07
4.3.90.0000.03712.07
4.3.80.0000.04712.07
4.3.70.0000.03712.07
4.3.60.0000.02712.07
4.3.50.0030.03312.07
4.3.40.0070.05012.07
4.3.30.0070.03312.07
4.3.20.0000.04012.07
4.3.10.0070.03012.07
4.3.00.0000.03712.07

preferences:
40.54 ms | 401 KiB | 5 Q