3v4l.org

run code in 300+ PHP versions simultaneously
<?php // run the callback a lot, return average run time in ms function clock(\Closure $callback, $iterations = 100000) { $begin = microtime(true); for ($i = 0; $i < $iterations; $i++) { $callback(); } $end = microtime(true) - $begin; return ($end / $iterations)*1000; } // nicely show me how long the name ran, and percent increase/decrease over last function report($name, $time) { static $last = null; printf("%-12s: %.8fms", $name, $time); if (null !== $last) { printf(", %.1f%%", (($time - $last)/$last)*100); } echo PHP_EOL; $last = $time; } // fixtures $a = str_repeat('a', 2<<8); class Os { public static function strcmp($a) { strcmp($a, $a); } } class Om { public function strcmp($a) { strcmp($a, $a); } } // do it report('direct call', clock(function () use ($a) { strcmp($a, $a); })); report('static call', clock(function () use ($a) { Os::strcmp($a); })); report('object call', clock(function () use ($a) { $o = new Om(); $o->strcmp($a); })); report('voodoo call', clock(function () use ($a) { $o = unserialize('O:2:"Om":0:{}'); $o->strcmp($a); }));

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)
7.4.60.0100.09416.37
7.4.50.0100.09716.25
7.4.40.0090.11116.70
7.4.30.0070.09416.55
7.4.20.0070.09516.44
7.4.10.0110.13316.02
7.4.00.0080.12915.98
7.3.180.0100.10516.33
7.3.170.0200.09616.37
7.3.160.0100.11716.41
7.3.150.0040.10416.62
7.3.140.0070.10316.45
7.3.130.0060.12015.60
7.3.120.0100.16615.67
7.3.110.0100.13115.66
7.3.100.0070.12015.72
7.3.90.0130.14315.54
7.3.80.0050.14515.61
7.3.70.0080.13515.56
7.3.60.0080.14615.57
7.3.50.0050.13315.54
7.3.40.0080.12215.64
7.3.30.0100.11215.64
7.3.20.0050.11916.50
7.3.10.0050.11916.37
7.3.00.0170.12216.57
7.2.310.0070.11116.33
7.2.300.0160.14416.61
7.2.290.0090.12116.40
7.2.280.0110.12216.52
7.2.270.0100.16416.45
7.2.260.0100.14816.01
7.2.250.0060.16515.71
7.2.240.0140.13915.89
7.2.230.0080.15115.82
7.2.220.0100.14015.84
7.2.210.0100.14015.71
7.2.200.0100.15715.82
7.2.190.0070.15415.90
7.2.180.0080.14615.88
7.2.170.0060.16215.91
7.2.160.0090.16915.90
7.2.150.0050.14116.64
7.2.140.0060.13316.78
7.2.130.0090.13316.65
7.2.120.0070.13416.66
7.2.110.0080.17116.81
7.2.100.0090.14216.62
7.2.90.0100.15316.68
7.2.80.0050.13916.71
7.2.70.0110.13016.74
7.2.60.0140.17416.80
7.2.50.0050.14016.78
7.2.40.0240.13116.75
7.2.30.0100.14516.84
7.2.20.0050.15116.73
7.2.10.0010.13416.71
7.2.00.0060.13216.48
7.1.330.0080.21315.82
7.1.320.0020.18815.76
7.1.310.0080.18915.60
7.1.300.0050.20615.72
7.1.290.0060.18315.82
7.1.280.0080.19315.84
7.1.270.0080.22315.66
7.1.260.0080.18315.59
7.1.250.0030.19415.51
7.1.240.0040.27615.70
7.1.230.0080.23015.65
7.1.220.0080.19215.68
7.1.210.0070.22315.61
7.1.200.0000.23015.69
7.1.190.0070.25015.61
7.1.180.0060.22715.57
7.1.170.0070.22015.60
7.1.160.0050.20015.81
7.1.150.0050.20915.54
7.1.140.0020.19915.64
7.1.130.0060.21315.51
7.1.120.0030.19315.47
7.1.110.0050.21415.55
7.1.100.0120.20615.51
7.1.90.0100.19915.67
7.1.80.0080.17615.57
7.1.70.0040.18516.24
7.1.60.0050.18416.94
7.1.50.0100.17516.00
7.1.40.0100.21315.56
7.1.30.0050.19515.64
7.1.20.0100.20115.77
7.1.10.0030.19315.64
7.1.00.0100.19417.86
7.0.330.0070.21715.38
7.0.320.0050.18815.23
7.0.310.0120.25915.15
7.0.300.0090.20315.30
7.0.290.0030.18915.23
7.0.280.0020.22715.23
7.0.270.0120.19315.31
7.0.260.0040.21915.31
7.0.250.0060.20315.14
7.0.240.0080.18715.25
7.0.230.0060.21215.19
7.0.220.0050.24915.16
7.0.210.0110.22715.30
7.0.200.0020.15815.70
7.0.190.0100.18715.31
7.0.180.0050.22115.30
7.0.170.0050.21515.48
7.0.160.0090.20015.21
7.0.150.0090.18015.39
7.0.140.0080.19515.24
7.0.130.0050.18615.22
7.0.120.0070.21315.29
7.0.110.0110.20315.29
7.0.100.0050.23215.33
7.0.90.0100.18815.30
7.0.80.0120.18515.36
7.0.70.0050.20717.43
7.0.60.0060.18617.51
7.0.50.0040.19117.61
7.0.40.0070.18716.27
7.0.30.0070.21216.22
7.0.20.0100.20716.25
7.0.10.0100.20016.19
7.0.00.0100.20616.29
5.6.400.0110.36914.88
5.6.390.0060.32015.07
5.6.380.0110.27715.03
5.6.370.0080.32215.06
5.6.360.0100.30515.09
5.6.350.0050.29414.97
5.6.340.0050.30415.11
5.6.330.0100.26915.13
5.6.320.0110.29015.11
5.6.310.0070.31315.19
5.6.300.0070.28415.27
5.6.290.0140.27315.25
5.6.280.0060.32117.06
5.6.270.0090.29315.03
5.6.260.0100.32315.11
5.6.250.0050.29415.10
5.6.240.0090.30515.26
5.6.230.0080.31415.06
5.6.220.0090.29016.98
5.6.210.0070.31417.06
5.6.200.0090.31617.10
5.6.190.0090.28916.96
5.6.180.0060.30717.13
5.6.170.0110.28617.14
5.6.160.0040.29317.03
5.6.150.0050.28617.11
5.6.140.0080.28516.96
5.6.130.0060.29416.96
5.6.120.0100.27117.11
5.6.110.0060.29217.08
5.6.100.0090.29717.07
5.6.90.0070.29716.93
5.6.80.0040.26216.92
5.6.70.0090.28316.78
5.6.60.0090.29616.90
5.6.50.0070.26016.83
5.6.40.0020.27116.89
5.6.30.0080.28016.81
5.6.20.0040.25816.85
5.6.10.0030.27716.88
5.6.00.0040.27016.73
5.5.380.0110.27615.06
5.5.370.0130.27515.03
5.5.360.0090.29316.79
5.5.350.0050.25816.82
5.5.340.0030.29617.03
5.5.330.0090.28716.89
5.5.320.0060.27416.98
5.5.310.0090.27416.92
5.5.300.0070.27816.93
5.5.290.0070.30717.11
5.5.280.0010.29016.97
5.5.270.0120.37616.81
5.5.260.0060.30116.82
5.5.250.0090.28016.88
5.5.240.0050.30716.76
5.5.230.0050.30216.63
5.5.220.0070.30916.73
5.5.210.0080.26716.64
5.5.200.0090.25516.63
5.5.190.0050.26616.70
5.5.180.0080.26216.77
5.5.170.0050.29714.90
5.5.160.0030.25716.63
5.5.150.0040.27016.56
5.5.140.0080.26716.62
5.5.130.0050.24516.77
5.5.120.0070.26916.52
5.5.110.0070.28616.72
5.5.100.0080.28116.58
5.5.90.0040.26216.76
5.5.80.0040.29616.71
5.5.70.0080.27116.74
5.5.60.0100.28116.72
5.5.50.0080.27016.67
5.5.40.0090.30016.74
5.5.30.0070.29316.65
5.5.20.0090.27616.56
5.5.10.0090.29716.66
5.5.00.0090.26216.59
5.4.450.0080.27714.64
5.4.440.0040.28914.69
5.4.430.0040.31414.71
5.4.420.0040.31114.72
5.4.410.0060.27114.57
5.4.400.0060.30914.57
5.4.390.0090.26914.59
5.4.380.0080.30514.61
5.4.370.0000.28314.57
5.4.360.0050.27314.56
5.4.350.0050.25114.50
5.4.340.0050.26314.57
5.4.330.0030.31512.19
5.4.320.0050.24814.51
5.4.310.0040.28414.63
5.4.300.0060.24814.62
5.4.290.0040.25514.52
5.4.280.0050.25914.52
5.4.270.0010.29514.64
5.4.260.0060.28214.54
5.4.250.0030.27914.52
5.4.240.0050.27714.49
5.4.230.0080.27414.56
5.4.220.0090.28114.68
5.4.210.0020.30214.52
5.4.200.0120.26214.61
5.4.190.0040.33514.62
5.4.180.0060.24714.62
5.4.170.0060.24514.47
5.4.160.0060.27614.69
5.4.150.0140.26914.54
5.4.140.0040.28713.69
5.4.130.0050.30113.69
5.4.120.0090.30613.75
5.4.110.0080.27313.69
5.4.100.0070.26813.73
5.4.90.0120.31013.75
5.4.80.0070.28313.77
5.4.70.0010.25913.84
5.4.60.0070.29013.73
5.4.50.0050.28513.71
5.4.40.0120.28613.68
5.4.30.0080.26213.70
5.4.20.0070.28413.68
5.4.10.0080.27313.68
5.4.00.0110.29413.52
5.3.290.0100.32914.01
5.3.280.0050.31713.78
5.3.270.0000.29913.95
5.3.260.0060.33913.88
5.3.250.0060.36313.89
5.3.240.0190.33013.81
5.3.230.0140.36913.86
5.3.220.0080.35013.69
5.3.210.0090.34613.81
5.3.200.0080.32613.76
5.3.190.0020.33413.89
5.3.180.0070.32913.83
5.3.170.0080.32713.94
5.3.160.0090.35413.82
5.3.150.0060.32713.95
5.3.140.0030.35113.91
5.3.130.0090.31513.77
5.3.120.0030.35013.86
5.3.110.0090.35813.88
5.3.100.0080.39313.44
5.3.90.0110.30413.58
5.3.80.0050.33213.39
5.3.70.0050.33913.50
5.3.60.0050.31713.57
5.3.50.0070.31913.52
5.3.40.0020.36713.56
5.3.30.0070.35513.55
5.3.20.0100.36413.38
5.3.10.0090.32613.21
5.3.00.0020.31113.35
5.2.170.0050.02812.23
5.2.160.0000.03812.19
5.2.150.0040.03412.21
5.2.140.0050.03412.18
5.2.130.0080.03212.28
5.2.120.0060.02812.21
5.2.110.0050.01612.11
5.2.100.0020.03512.12
5.2.90.0030.03512.28
5.2.80.0020.03212.18
5.2.70.0050.02012.18
5.2.60.0000.02312.13
5.2.50.0000.02112.19
5.2.40.0000.02612.11
5.2.30.0060.01512.18
5.2.20.0050.01612.02
5.2.10.0040.03312.08
5.2.00.0070.01512.04
5.1.60.0020.02711.65
5.1.50.0030.03011.66
5.1.40.0030.01511.86
5.1.30.0000.02011.82
5.1.20.0060.03011.72
5.1.10.0050.02011.84
5.1.00.0030.02311.64
5.0.50.0000.01711.43
5.0.40.0040.02111.43
5.0.30.0050.01711.43
5.0.20.0050.01711.43
5.0.10.0000.02711.43
5.0.00.0040.01711.43
4.4.90.0000.01111.43
4.4.80.0020.01811.43
4.4.70.0020.00911.43
4.4.60.0030.01211.43
4.4.50.0030.00811.43
4.4.40.0000.01411.43
4.4.30.0060.00811.43
4.4.20.0020.01611.43
4.4.10.0020.01911.43
4.4.00.0030.02011.43
4.3.110.0000.01311.43
4.3.100.0000.01911.43
4.3.90.0030.01111.43
4.3.80.0030.01211.43
4.3.70.0010.00811.43
4.3.60.0060.01011.43
4.3.50.0030.01811.43
4.3.40.0000.02311.43
4.3.30.0000.02111.43
4.3.20.0040.01811.43
4.3.10.0000.01811.43
4.3.00.0030.01011.43

preferences:
29.94 ms | 403 KiB | 5 Q