3v4l.org

run code in 300+ PHP versions simultaneously
#!/usr/bin/php <?php declare(strict_types=1); const ITERATIONS = 100000; $results = array(); for ($i = 0; $i < ITERATIONS; ++$i) { // heat up cpu (if it was powersaving-running-low-cus-nothing-was-happening, most modern cpus try to do it by default) } function array_is_list_post(array $array): bool { $i = 0; foreach ($array as $k => $v) { if ($k !== $i++) { return false; } } return true; } function array_is_list_pre(array $array): bool { $i = -1; foreach ($array as $k => $v) { ++$i; if ($k !== $i) { return false; } } return true; } $l1 = str_split(str_repeat("A", 300), 1); $t = microtime(true); for ($i = 0; $i < ITERATIONS; ++$i) { array_is_list_pre($l1); } $t = microtime(true) - $t; $results["pre"] = $t; $t = microtime(true); for ($i = 0; $i < ITERATIONS; ++$i) { array_is_list_post($l1); } $t = microtime(true) - $t; $results["post"] = $t; if ($results["pre"] === $results["post"]) { echo "it's a tie!"; } elseif ($results["pre"] < $results["post"]) { echo "pre is faster!"; } else { echo "post is faster!"; } echo "diff: " . abs(($results["pre"] - $results["post"])) . "\n"; var_dump($results); exit();

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.40.0111.31519.02
8.3.30.0301.35217.50
8.3.20.0231.26817.63
8.3.10.0371.42617.63
8.3.00.0231.20817.75
8.2.170.0331.31117.60
8.2.160.0471.20617.25
8.2.150.0301.22417.60
8.2.140.0201.32117.50
8.2.130.0301.37317.50
8.2.120.0301.34717.49
8.2.110.0301.36617.63
8.2.100.0231.25217.63
8.2.90.0271.25217.46
8.2.80.0401.24917.25
8.2.70.0341.22017.63
8.2.60.0191.00417.50
8.2.50.0191.00917.37
8.2.40.0120.91718.36
8.2.30.0230.99817.58
8.2.20.0140.97517.40
8.2.10.0200.98617.46
8.2.00.0111.00617.49
8.1.270.0371.18417.36
8.1.260.0301.27017.10
8.1.250.0461.23817.23
8.1.240.0301.35017.23
8.1.230.0301.40017.25
8.1.220.0201.28217.10
8.1.210.0131.24119.01
8.1.200.0131.26719.14
8.1.190.0121.00017.74
8.1.180.0171.01017.83
8.1.170.0161.03817.74
8.1.160.0111.01717.74
8.1.150.0111.01817.64
8.1.140.0121.00117.79
8.1.130.0130.96417.87
8.1.120.0070.95717.92
8.1.110.0090.95517.88
8.1.100.0091.01817.76
8.1.90.0110.95417.53
8.1.80.0080.95917.48
8.1.70.0100.93517.67
8.1.60.0120.95517.85
8.1.50.0100.99817.76
8.1.40.0130.98217.78
8.1.30.0090.99017.85
8.1.20.0130.99417.81
8.1.10.0120.99117.77
8.1.00.0150.98117.75
8.0.300.0140.90319.13
8.0.290.0131.23158.33
8.0.280.0131.22316.51
8.0.270.0171.09816.47
8.0.260.0121.01016.92
8.0.250.0211.02717.07
8.0.240.0111.01516.98
8.0.230.0121.00216.97
8.0.220.0120.99216.94
8.0.210.0120.99316.93
8.0.200.0141.02216.96
8.0.190.0131.02017.03
8.0.180.0121.10216.96
8.0.170.0131.05816.94
8.0.160.0131.09216.96
8.0.150.0151.09816.92
8.0.140.0141.03716.92
8.0.130.0131.04216.90
8.0.120.0151.07016.92
8.0.110.0141.03916.95
8.0.100.0121.07516.93
8.0.90.0141.16316.94
8.0.80.0141.04916.94
8.0.70.0151.06416.91
8.0.60.0121.04316.95
8.0.50.0121.06516.97
8.0.30.0131.10316.93
8.0.20.0101.08417.01
8.0.10.0101.06317.11
7.4.330.0101.10330.81
7.4.320.0141.00216.68
7.4.300.0131.04316.61
7.4.290.0151.06716.66
7.4.280.0161.04316.61
7.4.270.0151.04016.68
7.4.260.0161.08016.66
7.4.250.0131.06116.64
7.4.240.0161.05016.63
7.4.230.0161.05216.61
7.4.220.0151.06116.66
7.4.210.0121.03616.67
7.4.200.0111.03416.59
7.4.190.0131.04516.68
7.4.180.0101.05116.72
7.4.160.0141.03616.66
7.4.150.0121.03916.64
7.4.140.0111.03516.56
7.4.130.0091.04216.56
7.4.120.0101.14216.57
7.4.110.0111.06516.58
7.4.100.0091.03816.60
7.4.90.0131.03416.54
7.4.80.0131.04516.56
7.4.70.0121.06716.58
7.4.60.0071.06016.56
7.4.50.0081.06816.53
7.4.40.0111.06516.58
7.4.30.0101.07116.58
7.4.20.0081.10216.58
7.4.10.0111.02616.56
7.4.00.0091.02816.62

preferences:
45.16 ms | 400 KiB | 5 Q