3v4l.org

run code in 300+ PHP versions simultaneously
<?php function hinted(array $a, StdClass $b): int { return count($a); } function unhinted($a, $b) { return count($a); } $max = 10000000; $a = array(1,2,3,4); $b = new StdClass(); $b->foo = "bar"; // run unhinted test first to cause any possible cold startup effects to hit it more to make this as fair as possible for hinted code $start = microtime(true); for ($i=0; $i<$max; $i++) $rv = unhinted($a, $b); $elapsed_unhinted = microtime(true) - $start; printf("unhinted: Elapsed %.2f seconds\n", $elapsed_unhinted); $start = microtime(true); for ($i=0; $i<$max; $i++) $rv = hinted($a, $b); $elapsed_hinted = microtime(true) - $start; printf("hinted: Elapsed %.2f seconds\n", $elapsed_hinted); if ($elapsed_unhinted > 0) { $overhead = $elapsed_hinted / $elapsed_unhinted; if ($overhead <= 1.0) printf("No overhead for hinted signature, factor=%.2\n", $overhead); else printf("Type hinting causes %d %% overhead for small functions.\n", round(100*($overhead - 1.0))); }

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.4.120.0180.31124.14
8.4.110.0190.31417.54
8.4.100.0220.32117.40
8.4.90.0160.32617.32
8.4.80.0150.32017.76
8.4.70.0200.32717.77
8.4.60.0170.31417.63
8.4.50.0150.36118.25
8.4.40.0220.32017.57
8.4.30.0120.29617.72
8.4.20.0260.29717.64
8.4.10.0340.29817.61
8.3.250.0040.29518.95
8.3.240.0170.29616.57
8.3.230.0270.29616.70
8.3.220.0400.32416.74
8.3.210.0160.33616.67
8.3.200.0200.31216.36
8.3.190.0170.32916.44
8.3.180.0140.39816.62
8.3.170.0070.39716.67
8.3.160.0140.36716.49
8.3.150.0080.38416.57
8.3.140.0260.34916.43
8.3.130.0180.37816.55
8.3.120.0170.34216.52
8.3.110.0180.34316.41
8.3.100.0240.34716.36
8.3.90.0240.34216.34
8.3.80.0190.36316.39
8.3.70.0150.34916.49
8.3.60.0200.34616.38
8.3.50.0210.34716.61
8.3.40.0210.35317.58
8.3.30.0160.35017.61
8.3.20.0200.33617.41
8.3.10.0180.34817.58
8.3.00.0190.35017.56
8.2.290.0140.33516.66
8.2.280.0150.33416.87
8.2.270.0160.32016.70
8.2.260.0180.32016.33
8.2.250.0230.34316.69
8.2.240.0170.33916.50
8.2.230.0140.36316.28
8.2.220.0210.35916.46
8.2.210.0160.37016.38
8.2.200.0210.37716.63
8.2.190.0200.37016.54
8.2.180.0200.42416.55
8.2.170.0160.37217.62
8.2.160.0150.35217.69
8.2.150.0140.37017.44
8.2.140.0100.36217.70
8.2.130.0100.36117.51
8.2.120.0090.36717.60
8.2.110.0160.37619.41
8.2.100.0170.40717.57
8.2.90.0210.39717.74
8.2.80.0140.40517.43
8.2.70.0200.42329.90
8.2.60.0190.43829.91
8.2.50.0190.41929.89
8.2.40.0160.41729.94
8.2.30.0140.44028.37
8.2.20.0140.46128.11
8.2.10.0190.44328.06
8.2.00.0170.44928.02
8.1.330.0160.32415.96
8.1.320.0170.33815.73
8.1.310.0140.32415.88
8.1.300.0160.35016.15
8.1.290.0190.35916.19
8.1.280.0180.33516.16
8.1.270.0230.37617.25
8.1.260.0190.35417.50
8.1.250.0170.33917.31
8.1.240.0200.36218.15
8.1.230.0130.38617.72
8.1.220.0190.39817.41
8.1.210.0140.39017.26
8.1.200.0220.41429.77
8.1.190.0170.41829.66
8.1.180.0170.42929.72
8.1.170.0150.43229.68
8.1.160.0150.45027.91
8.1.150.0170.45627.86
8.1.140.0200.45827.93
8.1.130.0150.45427.94
8.1.120.0140.47828.03
8.1.110.0160.47327.91
8.1.100.0140.46526.40
8.1.90.0160.47526.44
8.1.80.0140.45926.43
8.1.70.0140.48526.39
8.1.60.0150.45526.53
8.1.50.0170.45926.40
8.1.40.0150.47226.47
8.1.30.0150.47326.46
8.1.20.0130.50126.52
8.1.10.0190.44826.49
8.1.00.0160.48926.44
8.0.300.0160.39917.82
8.0.290.0180.44629.37
8.0.280.0170.47327.49
8.0.270.0190.49327.46
8.0.260.0170.49227.51
8.0.250.0170.46827.50
8.0.240.0190.48627.51
8.0.230.0160.48826.05
8.0.220.0140.48425.97
8.0.210.0140.47825.98
8.0.200.0170.48426.00
8.0.190.0170.49926.01
8.0.180.0160.52325.97
8.0.170.0130.53126.05
8.0.160.0150.50025.97
8.0.150.0140.46825.99
8.0.140.0170.47026.00
8.0.130.0150.47626.02
8.0.120.0180.52826.00
8.0.110.0210.48425.99
8.0.100.0170.49025.93
8.0.90.0190.48725.93
8.0.80.0120.48725.95
8.0.70.0170.50025.87
8.0.60.0170.50225.95
8.0.50.0140.50525.93
8.0.30.0150.51726.03
8.0.20.0150.53826.04
8.0.10.0140.50426.07
7.4.330.0180.58327.12
7.4.320.0140.55227.28
7.4.300.0150.57825.69
7.4.290.0180.58525.70
7.4.280.0190.58625.73
7.4.270.0160.59425.71
7.4.260.0130.61525.69
7.4.250.0160.56225.64
7.4.240.0190.60825.70
7.4.230.0170.57325.70
7.4.220.0100.57025.62
7.4.210.0140.55525.71
7.4.200.0150.55625.75
7.4.190.0150.56425.69
7.4.180.0150.55225.78
7.4.160.0140.53525.75
7.4.150.0180.55225.72
7.4.140.0190.55625.72
7.4.130.0150.55325.66
7.4.120.0150.54125.64
7.4.110.0110.53925.66
7.4.100.0160.54525.72
7.4.90.0190.53725.64
7.4.80.0140.52225.66
7.4.70.0140.55525.71
7.4.60.0110.54725.65
7.4.50.0160.55325.60
7.4.40.0120.53825.65
7.4.30.0160.56225.65
7.4.20.0140.55225.66
7.4.10.0180.55125.65
7.4.00.0110.55925.69

preferences:
27.22 ms | 403 KiB | 5 Q