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 issetor($n) { $val = array(0,1,2,3,4,5,6,7,8,9); for ($i = 0; $i < $n; ++$i) $x = $val ?: null; } function issetor2($n) { $f = false; $j = 0; for ($i = 0; $i < $n; ++$i) $x = $f ?: $j + 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.0030.01716.96
8.0.100.0070.01116.84
8.0.90.0040.01416.98
8.0.80.0000.03617.00
8.0.70.0040.01516.94
8.0.60.0030.01416.90
8.0.50.0060.01117.05
8.0.30.0190.01017.03
8.0.20.0090.02217.00
8.0.10.0000.01817.09
8.0.00.0130.02516.74
7.4.240.0030.01416.65
7.4.230.0000.01716.38
7.4.220.0100.02616.77
7.4.210.0150.01916.67
7.4.200.0040.01416.79
7.4.190.0000.01716.53
7.4.160.0060.01916.39
7.4.150.0100.02016.47
7.4.140.0140.01716.64
7.4.130.0120.02516.71
7.4.120.0070.02116.40
7.4.110.0060.03316.55
7.4.100.0030.03416.57
7.4.90.0220.01616.59
7.4.80.0030.02516.68
7.4.70.0080.02816.66
7.4.60.0100.01716.50
7.4.50.0000.01916.52
7.4.40.0040.02616.41
7.4.30.0030.02516.59
7.4.10.0080.02415.09
7.4.00.0080.02214.98
7.3.300.0030.01416.28
7.3.290.0080.01916.41
7.3.280.0100.01916.37
7.3.270.0030.02716.46
7.3.260.0130.02316.57
7.3.250.0130.02216.59
7.3.240.0170.02316.70
7.3.230.0090.02216.50
7.3.210.0100.03216.50
7.3.200.0100.02119.39
7.3.190.0040.02516.35
7.3.180.0120.01816.48
7.3.170.0030.02716.41
7.3.160.0130.01616.66
7.3.130.0100.02314.83
7.3.120.0080.02414.96
7.3.110.0070.02714.90
7.3.100.0040.01914.80
7.3.90.0040.02114.93
7.3.80.0050.01814.90
7.3.70.0030.02414.93
7.3.60.0080.01714.88
7.3.50.0060.02114.87
7.3.40.0060.02114.77
7.3.30.0040.02014.69
7.3.20.0030.02216.85
7.3.10.0040.02116.76
7.3.00.0060.02116.71
7.2.330.0070.02516.61
7.2.320.0060.02716.50
7.2.310.0070.03616.47
7.2.300.0130.03216.87
7.2.290.0060.02916.66
7.2.260.0100.02215.02
7.2.250.0060.02615.07
7.2.240.0080.02215.03
7.2.230.0060.02315.00
7.2.220.0030.02515.09
7.2.210.0040.02115.07
7.2.200.0040.02015.06
7.2.190.0080.01914.97
7.2.180.0060.01815.03
7.2.170.0050.02115.21
7.2.160.0020.02515.21
7.2.150.0050.02116.81
7.2.140.0070.02117.01
7.2.130.0060.01916.86
7.2.120.0050.02116.88
7.2.110.0060.02216.81
7.2.100.0050.02316.84
7.2.90.0040.02416.80
7.2.80.0050.02116.96
7.2.70.0070.02117.00
7.2.60.0070.02117.05
7.2.50.0060.02016.94
7.2.40.0060.02217.02
7.2.30.0070.01916.96
7.2.20.0050.02116.93
7.2.10.0010.02116.85
7.2.00.0040.02217.68
7.1.330.0060.04415.83
7.1.320.0030.04215.79
7.1.310.0030.04115.72
7.1.300.0070.03915.74
7.1.290.0030.03815.72
7.1.280.0030.04315.84
7.1.270.0020.04115.82
7.1.260.0030.04315.71
7.1.250.0030.04315.72
7.1.240.0030.04415.83
7.1.230.0070.04115.75
7.1.220.0050.04015.83
7.1.210.0000.04415.93
7.1.200.0030.04415.89
7.1.190.0060.03915.85
7.1.180.0030.04315.74
7.1.170.0050.04215.67
7.1.160.0050.04315.83
7.1.150.0030.04015.85
7.1.140.0030.04015.93
7.1.130.0030.03815.80
7.1.120.0050.03915.96
7.1.110.0050.03915.75
7.1.100.0020.03316.68
7.1.90.0050.04115.91
7.1.80.0030.04315.83
7.1.70.0010.03416.34
7.1.60.0060.04017.00
7.1.50.0010.03716.15
7.1.40.0080.03415.89
7.1.30.0030.04015.63
7.1.20.0050.03915.74
7.1.10.0070.04115.83
7.1.00.0030.04918.00
7.0.330.0070.04415.04
7.0.320.0070.03815.58
7.0.310.0030.03915.29
7.0.300.0030.04515.41
7.0.290.0030.04115.44
7.0.280.0000.04315.49
7.0.270.0020.04615.35
7.0.260.0080.03715.34
7.0.250.0020.03915.49
7.0.240.0070.04415.50
7.0.230.0080.03915.49
7.0.220.0060.03715.50
7.0.210.0050.03815.34
7.0.200.0020.03415.87
7.0.190.0080.03415.43
7.0.180.0100.04115.38
7.0.170.0050.05015.40
7.0.160.0030.04115.51
7.0.150.0020.04115.44
7.0.140.0050.05617.58
7.0.130.0070.04115.58
7.0.120.0050.04717.78
7.0.110.0020.05517.62
7.0.100.0040.05017.68
7.0.90.0030.05917.67
7.0.80.0050.05017.74
7.0.70.0010.05417.43
7.0.60.0080.05217.52
7.0.50.0030.05817.84
7.0.40.0070.04416.48
7.0.30.0030.04716.46
7.0.20.0070.04516.40
7.0.10.0030.04116.42
7.0.00.0040.04716.39
5.6.400.0020.08614.22
5.6.390.0020.08714.15
5.6.380.0080.07914.34
5.6.370.0050.08314.52
5.6.360.0050.07914.43
5.6.350.0050.08314.49
5.6.340.0030.08414.63
5.6.330.0030.08114.44
5.6.320.0030.08614.56
5.6.310.0070.08014.55
5.6.300.0050.08614.39
5.6.290.0030.08314.66
5.6.280.0060.09216.65
5.6.270.0080.08514.58
5.6.260.0040.08616.60
5.6.250.0040.09016.59
5.6.240.0040.09116.56
5.6.230.0030.08216.56
5.6.220.0060.07916.62
5.6.210.0020.09216.51
5.6.200.0060.08816.65
5.6.190.0070.09116.39
5.6.180.0060.07816.48
5.6.170.0080.07816.67
5.6.160.0060.07916.66
5.6.150.0040.07616.65
5.6.140.0010.08416.42
5.6.130.0070.09816.52
5.6.120.0060.09316.50
5.6.110.0070.09516.63
5.6.100.0050.09716.46
5.6.90.0040.09216.61
5.6.80.0080.08316.31
5.6.70.0020.09716.31
5.6.60.0030.09616.41
5.6.50.0060.09416.45
5.6.40.0060.08916.38
5.6.30.0010.09216.34
5.6.20.0040.10716.35
5.6.10.0080.08316.25
5.6.00.0040.08816.51
5.5.380.0010.08215.30
5.5.370.0030.08315.23
5.5.360.0020.09415.32
5.5.350.0040.08515.49
5.5.340.0020.08715.60
5.5.330.0050.07615.61
5.5.320.0040.07915.47
5.5.310.0070.08315.64
5.5.300.0010.08715.50
5.5.290.0050.09615.53
5.5.280.0030.09015.60
5.5.270.0030.08815.74
5.5.260.0010.09815.63
5.5.250.0070.09115.45
5.5.240.0040.08815.40
5.5.230.0100.09615.29
5.5.220.0070.08515.13
5.5.210.0030.09015.23
5.5.200.0030.09315.32
5.5.190.0070.09415.32
5.5.180.0060.09415.28
5.5.170.0080.08514.38
5.5.160.0030.09015.38
5.5.150.0010.09515.36
5.5.140.0060.09815.28
5.5.130.0070.09215.25
5.5.120.0040.09015.33
5.5.110.0040.09215.33
5.5.100.0010.09815.27
5.5.90.0040.09215.22
5.5.80.0030.08915.24
5.5.70.0020.08915.27
5.5.60.0060.07515.41
5.5.50.0020.07615.38
5.5.40.0030.09715.33
5.5.30.0020.08615.39
5.5.20.0040.07915.27
5.5.10.0040.08715.40
5.5.00.0010.08315.13
5.4.450.0000.10013.99
5.4.440.0010.10213.84
5.4.430.0040.09213.80
5.4.420.0030.09713.75
5.4.410.0020.10913.94
5.4.400.0060.09313.89
5.4.390.0020.11113.95
5.4.380.0010.10313.77
5.4.370.0030.09513.53
5.4.360.0030.08113.72
5.4.350.0030.08613.80
5.4.340.0070.08813.84
5.4.330.0020.09111.01
5.4.320.0010.08313.86
5.4.310.0040.07513.80
5.4.300.0030.08913.68
5.4.290.0020.09913.80
5.4.280.0030.08513.70
5.4.270.0020.08813.85
5.4.260.0030.09213.78
5.4.250.0020.09713.69
5.4.240.0010.09413.84
5.4.230.0040.07713.75
5.4.220.0030.07513.81
5.4.210.0030.07913.57
5.4.200.0060.09013.70
5.4.190.0020.09113.71
5.4.180.0000.08013.72
5.4.170.0030.10013.78
5.4.160.0010.10313.81
5.4.150.0010.07713.83
5.4.140.0020.07713.05
5.4.130.0000.08412.81
5.4.120.0020.08512.98
5.4.110.0030.10312.75
5.4.100.0030.10012.84
5.4.90.0000.09612.88
5.4.80.0020.09012.83
5.4.70.0010.08612.99
5.4.60.0040.09612.75
5.4.50.0060.08212.74
5.4.40.0040.09013.00
5.4.30.0010.08612.87
5.4.20.0020.08613.01
5.4.10.0040.09012.77
5.4.00.0020.08812.67
5.3.290.0010.12612.08
5.3.280.0070.14012.05
5.3.270.0020.15412.06
5.3.260.0020.15412.06
5.3.250.0060.13212.05
5.3.240.0020.13612.01
5.3.230.0040.12912.07
5.3.220.0020.13712.04
5.3.210.0040.13212.01
5.3.200.0020.14611.97
5.3.190.0040.15012.01
5.3.180.0040.14412.01
5.3.170.0040.14112.09
5.3.160.0040.13612.02
5.3.150.0040.13912.04
5.3.140.0040.13012.01
5.3.130.0030.15012.01
5.3.120.0010.14312.00
5.3.110.0010.14412.01
5.3.100.0090.15511.87
5.3.90.0020.12611.86
5.3.80.0040.13611.83
5.3.70.0040.14811.85
5.3.60.0050.15911.87
5.3.50.0020.13311.81
5.3.40.0010.14911.84
5.3.30.0000.14211.79
5.3.20.0010.12311.74
5.3.10.0020.14711.74
5.3.00.0010.11911.71
5.2.170.0000.04011.28
5.2.160.0030.02711.23
5.2.150.0030.03311.04
5.2.140.0000.03711.39
5.2.130.0030.04711.27
5.2.120.0000.04011.25
5.2.110.0070.02011.18
5.2.100.0030.04311.13
5.2.90.0030.05711.14
5.2.80.0000.05011.10
5.2.70.0030.05311.25
5.2.60.0000.05311.09
5.2.50.0000.05711.27
5.2.40.0030.04011.03
5.2.30.0030.05311.00
5.2.20.0000.05310.94
5.2.10.0030.05010.95
5.2.00.0030.05310.83
5.1.60.0030.05010.02
5.1.50.0030.04710.03
5.1.40.0000.03310.01
5.1.30.0030.04710.38
5.1.20.0000.04310.37
5.1.10.0030.03710.08
5.1.00.0030.04710.07
5.0.50.0000.0409.93
5.0.40.0030.0279.93
5.0.30.0030.0539.93
5.0.20.0000.0409.93
5.0.10.0030.0309.93
5.0.00.0000.0309.93
4.4.90.0000.0279.93
4.4.80.0000.0239.93
4.4.70.0000.0309.93
4.4.60.0000.0309.93
4.4.50.0000.0309.93
4.4.40.0030.0379.93
4.4.30.0000.0239.93
4.4.20.0000.0309.93
4.4.10.0000.0309.93
4.4.00.0070.0379.93
4.3.110.0000.0309.93
4.3.100.0000.0239.93
4.3.90.0000.0209.93
4.3.80.0000.0439.93
4.3.70.0000.0179.93
4.3.60.0030.0309.93
4.3.50.0000.0239.93
4.3.40.0030.0239.93
4.3.30.0070.0209.93
4.3.20.0000.0239.93
4.3.10.0000.0239.93
4.3.00.0030.0279.93

preferences:
32.6 ms | 400 KiB | 5 Q