3v4l.org

run code in 200+ php & hhvm versions
<?php function report($name, $time, $base) { printf("%-12s: %.8fms", $name, $time); printf(", %.1f%%", (($time - $base)/$base)*100); echo PHP_EOL; } $iterations = 100000; $a = str_repeat('a', 2<<8); $times = array( "loop" => 0, "direct" => 0, "static" => 0, "object" => 0 ); class Os { public static function strcmp($a) { strcmp($a, $a); } } class Om { public function strcmp($a) { strcmp($a, $a); } } $o = new Om(); $start = microtime(true); for ($x=0; $x<$iterations; ++$x) {} $end = microtime(true) - $start; $times["loop"]+= $end; $start = microtime(true); for ($x=0; $x<$iterations; ++$x) { strcmp($a, $a); } $end = microtime(true) - $start; $times["direct"]+= $end; $start = microtime(true); for ($x=0; $x<$iterations; ++$x) { Os::strcmp($a); } $end = microtime(true) - $start; $times["static"]+= $end; $start = microtime(true); for ($x=0; $x<$iterations; ++$x) { $o->strcmp($a); } $end = microtime(true) - $start; $times["object"]+= $end; foreach ($times as $name => $time) { report($name, ($time/$iterations)*1000, ($times['loop']/$iterations)*1000); }

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).
Note: hhvm uses a JIT which only kicks in after a few runs. Since we run scripts only once, hhvm always runs slower.

VersionSystem time (s)User time (s)Memory (MiB)
7.3.10.0040.02516.66
7.3.00.0100.02116.56
7.2.130.0070.02316.65
7.2.120.0040.02216.90
7.2.110.0090.02416.93
7.2.100.0000.03416.73
7.2.90.0130.01916.96
7.2.80.0030.03017.11
7.2.70.0060.02817.16
7.2.60.0030.02717.09
7.2.50.0060.02216.85
7.2.40.0030.02816.81
7.2.30.0060.02616.86
7.2.20.0100.01916.93
7.2.10.0060.02216.96
7.2.00.0000.03017.02
7.1.250.0030.05015.77
7.1.70.0030.02317.21
7.1.60.0070.04719.50
7.1.50.0070.05717.02
7.1.00.0000.11022.37
7.0.200.0060.01916.84
7.0.60.0030.09719.96
7.0.50.0070.11717.85
7.0.40.0100.10320.10
7.0.30.0600.09020.10
7.0.20.0370.09720.07
7.0.10.0170.11020.15
7.0.00.0100.11020.19
5.6.280.0000.14021.08
5.6.210.0130.08020.73
5.6.200.0130.13318.18
5.6.190.0000.09020.40
5.6.180.4070.08020.47
5.6.170.0370.08320.38
5.6.160.0030.12320.61
5.6.150.0030.09018.18
5.6.140.0030.14018.23
5.6.130.0030.13018.26
5.6.120.0100.12021.02
5.6.110.0100.14720.98
5.6.100.0070.10021.11
5.6.90.0070.15720.99
5.6.80.0100.13020.55
5.5.350.0100.08720.37
5.5.340.0000.08717.98
5.5.330.0100.14720.40
5.5.320.0330.13720.24
5.5.310.0300.13320.30
5.5.300.0070.13017.99
5.5.290.0270.08718.04
5.5.280.0070.10320.77
5.5.270.0070.14320.90
5.5.260.0070.08020.66
5.5.250.0030.08320.59
5.5.240.0230.12720.28
5.4.450.0500.11019.41
5.4.440.0300.07319.54
5.4.430.0130.12019.33
5.4.420.0070.12319.39
5.4.410.0170.10718.71
5.4.400.0130.11318.68
5.4.390.0100.14018.80
5.4.380.0030.12718.76
5.4.370.0130.11318.59
5.4.360.0030.12018.46
5.4.350.0130.11718.81
5.4.340.0130.11318.74
5.4.320.0100.12018.73
5.4.310.0100.12318.71
5.4.300.0100.13318.71
5.4.290.0230.10718.62
5.4.280.0130.11018.76
5.4.270.0100.11718.74
5.4.260.0170.11018.75
5.4.250.0170.11018.78
5.4.240.0170.10718.46
5.4.230.0070.11718.75
5.4.220.0170.11318.82
5.4.210.0170.11018.50
5.4.200.0100.12016.64
5.4.190.0100.11318.61
5.4.180.0100.11718.61
5.4.170.0130.12018.58
5.4.160.0070.12318.72
5.4.150.0030.13318.79
5.4.140.0100.11316.29
5.4.130.0070.11716.27
5.4.120.0170.11316.31
5.4.110.0000.12716.45
5.4.100.0130.11016.36
5.4.90.0070.12716.30
5.4.80.0170.10316.29
5.4.70.0130.12016.42
5.4.60.0130.12016.21
5.4.50.0100.11716.28
5.4.40.0070.12316.31
5.4.30.0100.12316.19
5.4.20.0000.12716.18
5.4.10.0100.11316.13
5.4.00.0070.11315.74
5.3.290.0100.15714.90
5.3.280.0130.14714.61
5.3.270.0030.16714.83
5.3.260.0130.21314.61
5.3.250.0070.17014.84
5.3.240.0100.15714.81
5.3.230.0100.17014.75
5.3.220.0100.15714.73
5.3.210.0170.15714.61
5.3.200.0070.16714.68
5.3.190.0100.15314.63
5.3.180.0170.15714.68
5.3.170.0000.17314.56
5.3.160.0100.24714.61
5.3.150.0070.15314.57
5.3.140.0070.15314.67
5.3.130.0200.15314.62
5.3.120.0130.16714.67
5.3.110.0170.16714.75
5.3.100.0100.15014.11
5.3.90.0030.16014.02
5.3.80.0100.16714.11
5.3.70.0170.14314.05
5.3.60.0100.14714.09
5.3.50.0130.14713.99
5.3.40.0130.15014.00
5.3.30.0070.14714.02
5.3.20.0130.15313.78
5.3.10.0130.15713.78
5.3.00.0200.14313.65
5.2.170.0070.16711.22
5.2.160.0030.17011.19
5.2.150.0100.16711.21
5.2.140.0070.17011.29
5.2.130.0070.16311.10
5.2.120.0070.15711.25
5.2.110.0100.16011.11
5.2.100.0170.15711.35
5.2.90.0030.16011.12
5.2.80.0000.16711.23
5.2.70.0000.16711.33
5.2.60.0000.17011.17
5.2.50.0070.15311.24
5.2.40.0130.15711.11
5.2.30.0100.16011.06
5.2.20.0000.17010.97
5.2.10.0070.15310.93
5.2.00.0000.17310.79
5.1.60.0070.17310.15
5.1.50.0100.15010.04
5.1.40.0130.15310.21
5.1.30.0070.15010.43
5.1.20.0170.14010.40
5.1.10.0070.15310.19
5.1.00.0070.17310.17
5.0.50.0070.2538.65
5.0.40.0100.2608.48
5.0.30.0070.2608.33
5.0.20.0200.2438.32
5.0.10.0030.2578.33
5.0.00.0070.2778.24
4.4.90.0030.0205.98
4.4.80.0000.0275.89
4.4.70.0070.0205.98
4.4.60.0130.0205.89
4.4.50.0030.0205.89
4.4.40.0000.0375.89
4.4.30.0030.0235.91
4.4.20.0000.0275.98
4.4.10.0030.0235.96
4.4.00.0100.0305.95
4.3.110.0030.0235.91
4.3.100.0000.0275.86
4.3.90.0070.0175.89
4.3.80.0070.0335.93
4.3.70.0030.0275.83
4.3.60.0030.0205.81
4.3.50.0070.0205.86
4.3.40.0030.0335.80
4.3.30.0030.0204.58
4.3.20.0030.0304.56
4.3.10.0000.0304.51
4.3.00.0000.01315.49