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(); } class Foo { static $a = 0; public $b = 0; const TEST = 0; static function read_static($n) { for ($i = 0; $i < $n; ++$i) $x = self::$a; } static function write_static($n) { for ($i = 0; $i < $n; ++$i) self::$a = 0; } static function isset_static($n) { for ($i = 0; $i < $n; ++$i) $x = isset(self::$a); } static function empty_static($n) { for ($i = 0; $i < $n; ++$i) $x = empty(self::$a); } static function f() {} static function call_static($n) { for ($i = 0; $i < $n; ++$i) self::f(); } function read_prop($n) { for ($i = 0; $i < $n; ++$i) $x = $this->b; } function write_prop($n) { for ($i = 0; $i < $n; ++$i) $this->b = 0; } function assign_add_prop($n) { for ($i = 0; $i < $n; ++$i) $this->b += 2; } function pre_inc_prop($n) { for ($i = 0; $i < $n; ++$i) ++$this->b; } function pre_dec_prop($n) { for ($i = 0; $i < $n; ++$i) --$this->b; } function post_inc_prop($n) { for ($i = 0; $i < $n; ++$i) $this->b++; } function post_dec_prop($n) { for ($i = 0; $i < $n; ++$i) $this->b--; } function isset_prop($n) { for ($i = 0; $i < $n; ++$i) $x = isset($this->b); } function empty_prop($n) { for ($i = 0; $i < $n; ++$i) $x = empty($this->b); } function g() {} function call($n) { for ($i = 0; $i < $n; ++$i) $this->g(); } function read_const($n) { for ($i = 0; $i < $n; ++$i) $x = $this::TEST; } } function read_static($n){ for ($i = 0; $i < $n; ++$i) $x = Foo::$a; } function write_static($n) { for ($i = 0; $i < $n; ++$i) Foo::$a = 0; } function isset_static($n) { for ($i = 0; $i < $n; ++$i) $x = isset(Foo::$a); } function empty_static($n) { for ($i = 0; $i < $n; ++$i) $x = empty(Foo::$a); } function call_static($n) { for ($i = 0; $i < $n; ++$i) Foo::f(); } function create_object($n) { for ($i = 0; $i < $n; ++$i) $x = new Foo(); } 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); Foo::write_static(N); Foo::isset_static(N); Foo::empty_static(N); read_static(N); write_static(N); isset_static(N); empty_static(N); Foo::call_static(N); call_static(N); $x = new Foo(); $x->read_prop(N); $x->write_prop(N); $x->assign_add_prop(N); $x->pre_inc_prop(N); $x->pre_dec_prop(N); $x->post_inc_prop(N); $x->post_dec_prop(N); $x->isset_prop(N); $x->empty_prop(N); $x->call(N); $x->read_const(N); create_object(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.3.60.0160.03516.75
8.3.50.0120.04521.99
8.3.40.0060.04818.85
8.3.30.0070.03319.11
8.3.20.0090.01220.52
8.3.10.0060.01523.48
8.3.00.0000.02120.71
8.2.180.0100.03116.50
8.2.170.0100.02922.96
8.2.160.0160.02221.97
8.2.150.0070.01424.18
8.2.140.0030.02024.66
8.2.130.0060.01526.16
8.2.120.0060.01522.20
8.2.110.0100.02619.36
8.2.100.0100.02017.97
8.2.90.0070.02019.30
8.2.80.0000.02617.97
8.2.70.0030.02417.75
8.2.60.0030.02718.28
8.2.50.0060.01918.07
8.2.40.0000.02618.47
8.2.30.0000.02518.20
8.2.20.0070.02017.90
8.2.10.0060.01917.86
8.2.00.0000.02617.96
8.1.280.0130.03725.92
8.1.270.0030.01723.96
8.1.260.0030.01826.35
8.1.250.0060.01528.09
8.1.240.0030.03422.33
8.1.230.0110.01819.16
8.1.220.0000.02617.79
8.1.210.0070.02018.77
8.1.200.0030.02617.60
8.1.190.0000.02917.66
8.1.180.0070.02018.10
8.1.170.0070.02018.66
8.1.160.0000.02522.18
8.1.150.0000.02518.68
8.1.140.0000.02717.52
8.1.130.0000.02417.94
8.1.120.0030.02217.60
8.1.110.0030.02317.64
8.1.100.0000.02517.59
8.1.90.0030.02217.53
8.1.80.0000.02617.56
8.1.70.0090.01617.54
8.1.60.0030.03317.73
8.1.50.0030.03117.46
8.1.40.0000.03417.64
8.1.30.0030.03417.78
8.1.20.0030.03417.74
8.1.10.0070.03017.57
8.1.00.0000.03417.48
8.0.300.0030.02318.77
8.0.290.0000.02616.75
8.0.280.0030.02318.48
8.0.270.0030.02317.29
8.0.260.0000.02516.84
8.0.250.0040.02216.99
8.0.240.0000.02617.06
8.0.230.0100.01717.04
8.0.220.0070.01816.90
8.0.210.0030.02316.99
8.0.200.0000.02717.07
8.0.190.0070.03017.06
8.0.180.0070.02817.11
8.0.170.0060.02917.03
8.0.160.0000.03416.89
8.0.150.0000.03416.96
8.0.140.0070.03116.98
8.0.130.0000.03413.43
8.0.120.0000.03517.01
8.0.110.0030.03117.03
8.0.100.0030.03116.96
8.0.90.0000.03517.03
8.0.80.0130.05116.97
8.0.70.0070.03116.89
8.0.60.0060.02817.05
8.0.50.0030.03317.03
8.0.30.0140.05317.43
8.0.20.0130.04817.40
8.0.10.0030.03117.13
8.0.00.0140.03616.85
7.4.330.0030.02315.05
7.4.320.0000.02616.64
7.4.300.0000.02716.72
7.4.290.0030.03416.64
7.4.280.0000.04316.53
7.4.270.0030.03416.54
7.4.260.0030.03216.71
7.4.250.0030.03316.45
7.4.240.0070.03016.58
7.4.230.0000.03516.61
7.4.220.0160.06216.65
7.4.210.0100.04916.72
7.4.200.0040.03216.66
7.4.190.0070.03016.81
7.4.160.0090.04016.39
7.4.150.0130.04217.40
7.4.140.0110.04117.86
7.4.130.0090.04216.67
7.4.120.0080.05616.67
7.4.110.0100.04116.51
7.4.100.0060.06316.64
7.4.90.0150.04016.64
7.4.80.0060.07116.72
7.4.70.0160.06316.59
7.4.60.0090.04216.63
7.4.50.0040.02116.47
7.4.40.0070.04122.77
7.4.30.0130.04616.45
7.4.00.0060.04215.02
7.3.330.0000.03513.29
7.3.320.0030.03313.57
7.3.310.0070.03016.40
7.3.300.0030.03316.53
7.3.290.0100.07016.52
7.3.280.0100.06316.50
7.3.270.0130.04217.40
7.3.260.0060.04716.42
7.3.250.0100.05316.60
7.3.240.0100.07116.50
7.3.230.0130.04016.59
7.3.210.0070.07316.71
7.3.200.0140.06019.39
7.3.190.0130.06616.79
7.3.180.0100.04416.58
7.3.170.0120.04416.69
7.3.160.0130.05616.52
7.3.120.0070.04215.02
7.3.10.0090.04016.57
7.3.00.0110.04616.48
7.2.330.0100.07216.64
7.2.320.0100.05316.89
7.2.310.0170.07616.82
7.2.300.0100.05216.82
7.2.290.0060.07816.79
7.2.130.0130.04216.42
7.2.120.0110.04416.50
7.2.110.0130.04616.63
7.2.100.0090.04116.44
7.2.90.0110.05116.78
7.2.80.0100.04816.55
7.2.70.0100.04616.58
7.2.60.0070.04516.68
7.2.50.0100.04916.56
7.2.40.0120.04816.51
7.2.30.0120.04817.01
7.2.20.0070.04716.67
7.2.10.0110.05116.76
7.2.00.0090.04517.25
7.1.250.0100.10215.65
7.1.200.0070.03715.72
7.1.100.0000.06518.03
7.1.70.0030.04517.02
7.1.60.0130.06719.27
7.1.50.0000.07917.02
7.1.00.0030.12722.41
7.0.200.0060.04216.82
7.0.140.0030.11721.99
7.0.100.0330.12720.20
7.0.90.0330.12319.99
7.0.80.0030.12019.98
7.0.70.0070.08020.13
7.0.60.0330.09319.99
7.0.50.0330.11720.43
7.0.40.0130.11020.09
7.0.30.0130.10320.18
7.0.20.0070.13319.96
7.0.10.0100.11320.07
7.0.00.0000.13020.13
5.6.280.0070.17321.20
5.6.250.0070.18720.71
5.6.240.0070.15720.72
5.6.230.0130.17320.77
5.6.220.0070.11020.63
5.6.210.0030.19020.54
5.6.200.0100.14321.17
5.6.190.0130.15721.12
5.6.180.0130.12721.21
5.6.170.0100.16021.11
5.6.160.0030.16021.19
5.6.150.0100.11321.14
5.6.140.0100.19321.16
5.6.130.0070.14321.25
5.6.120.0070.16021.17
5.6.110.0070.18721.09
5.6.100.0070.14721.04
5.6.90.0030.16321.08
5.6.80.0100.17020.57
5.6.70.0070.16720.41
5.6.60.0100.11020.39
5.6.50.0230.17020.63
5.6.40.0030.17020.61
5.6.30.0030.12320.58
5.6.20.0070.14320.39
5.6.10.0270.11020.46
5.6.00.0130.12020.45
5.5.380.0070.17720.47
5.5.370.0100.17020.45
5.5.360.0100.18320.42
5.5.350.0070.18320.41
5.5.340.0100.10720.89
5.5.330.0000.11021.00
5.5.320.0100.10320.88
5.5.310.0030.18020.87
5.5.300.0030.17320.91
5.5.290.0070.18720.95
5.5.280.0100.16720.86
5.5.270.0070.16321.00
5.5.260.0100.18720.87
5.5.250.0100.17720.67
5.5.240.0070.11720.37
5.5.230.0100.14720.37
5.5.220.0130.16320.34
5.5.210.0100.17720.38
5.5.200.0030.15020.32
5.5.190.0170.15020.32
5.5.180.0100.16020.21
5.5.160.0100.16020.33
5.5.150.0100.16720.25
5.5.140.0100.15020.35
5.5.130.0030.16020.31
5.5.120.0070.17720.19
5.5.110.0070.17720.18
5.5.100.0070.14320.15
5.5.90.0070.17720.14
5.5.80.0070.18020.14
5.5.70.0070.17720.23
5.5.60.0070.15320.14
5.5.50.0100.15720.23
5.5.40.0200.15720.23
5.5.30.0100.15320.01
5.5.20.0170.17320.13
5.5.10.0070.15320.04
5.5.00.0130.12320.13
5.4.450.0070.16019.24
5.4.440.0130.18019.45
5.4.430.0030.11019.37
5.4.420.0070.17019.46
5.4.410.0100.15019.29
5.4.400.0000.18319.21
5.4.390.0100.16719.23
5.4.380.0130.15319.20
5.4.370.0030.16319.13
5.4.360.0130.14019.06
5.4.350.0130.15019.13
5.4.340.0070.16719.13
5.4.320.0070.14318.97
5.4.310.0100.12319.07
5.4.300.0070.11719.03
5.4.290.0100.09718.91
5.4.280.0000.18319.17
5.4.270.0100.14718.91
5.4.260.0000.16319.12
5.4.250.0170.11719.04
5.4.240.0070.12319.05
5.4.230.0130.15019.04
5.4.220.0100.17319.19
5.4.210.0230.11319.06
5.4.200.0100.16719.04
5.4.190.0100.16018.95
5.4.180.0070.19719.19
5.4.170.0070.16718.89
5.4.160.0070.10319.11
5.4.150.0030.11319.18
5.4.140.0100.15316.47
5.4.130.0100.16716.43
5.4.120.0130.13316.25
5.4.110.0070.17316.58
5.4.100.0070.16016.55
5.4.90.0030.12316.54
5.4.80.0030.18316.42
5.4.70.0130.14016.45
5.4.60.0070.16316.31
5.4.50.0030.16316.53
5.4.40.0000.17016.36
5.4.30.0130.14016.45
5.4.20.0170.14316.36
5.4.10.0070.13016.38
5.4.00.0100.16015.80
5.3.290.0070.20714.76
5.3.280.0030.22014.62
5.3.270.0130.17014.85
5.3.260.0170.23014.76
5.3.250.0000.17714.70
5.3.240.0100.16314.77
5.3.230.0100.19314.73
5.3.220.0070.21714.69
5.3.210.0030.23314.75
5.3.200.0070.24314.81
5.3.190.0030.24314.63
5.3.180.0030.23714.72
5.3.170.0130.24014.75
5.3.160.0030.26314.60
5.3.150.0070.24014.72
5.3.140.0000.22714.69
5.3.130.0000.24014.66
5.3.120.0070.24314.77
5.3.110.0070.25314.64
5.3.100.0170.25014.07
5.3.90.0030.24714.18
5.3.80.0130.22714.18
5.3.70.0070.24314.00
5.3.60.0030.18314.09
5.3.50.0030.19314.17
5.3.40.0030.26014.10
5.3.30.0070.25013.90
5.3.20.0070.25313.71
5.3.10.0170.20713.80
5.3.00.0170.28713.85

preferences:
48.31 ms | 401 KiB | 5 Q