3v4l.org

run code in 300+ PHP versions simultaneously
<?php const ITERATION = 1000000; $collection = array(); for ($i = 0; $i < ITERATION; $i++) { $collection[] = rand(1, 1000000); } $time_start = microtime(true); $heap = new SplMinHeap; array_walk($collection, function($item) use ($heap) { $heap->insert($item); }, $collection); //$heap->top(); $current = $heap->current(); $time_end = microtime(true); $time = $time_end - $time_start; var_dump($current, $time, min($collection)); reset($collection); $time_start = microtime(true); $heap = new SplMinHeap; foreach ($collection as $item) { $heap->insert($item); } //$heap->top(); $current = $heap->current(); $time_end = microtime(true); $time = $time_end - $time_start; var_dump($current, $time); reset($collection); $time_start = microtime(true); $array = array(); foreach($collection as $item) { $array[] = $item; } $current = min($array); $time_end = microtime(true); $time = $time_end - $time_start; var_dump($current, $time);

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.2.00.0160.05553.36
7.1.70.0300.10250.78
7.1.60.0170.14551.38
7.1.50.0200.13951.02
7.1.00.0170.19756.36
7.0.200.0260.09550.91
7.0.140.0130.17056.08
7.0.110.9800.17352.95
7.0.100.0330.18053.08
7.0.91.0000.12753.08
7.0.80.9400.13052.86
7.0.70.4930.15352.93
7.0.61.0300.14752.99
7.0.50.9470.14053.23
7.0.40.9000.12352.01
7.0.30.8800.14052.01
7.0.21.0000.15352.06
7.0.10.9230.16052.09
7.0.00.4400.19352.03
5.6.250.0470.15785.34
5.6.240.0200.17085.31
5.6.230.0370.19785.34
5.6.220.0300.21085.11
5.6.210.0400.17785.28
5.6.200.0100.20785.69
5.6.190.0070.16385.58
5.6.180.0130.19385.76
5.6.170.0300.19385.77
5.6.160.0130.15085.92
5.6.150.0270.14085.79
5.6.140.0500.17385.58
5.6.130.0200.14785.67
5.6.120.0230.19085.64
5.6.110.0270.19085.66
5.6.100.0170.19085.63
5.6.90.0200.15385.82
5.6.80.0300.13085.12
5.6.70.0130.16085.26
5.6.60.0330.21385.31
5.6.50.0130.12785.12
5.6.40.0330.19784.96
5.6.30.0270.14084.96
5.6.20.0270.20785.22
5.6.10.0230.17385.27
5.6.00.0470.17385.18
5.5.380.0100.14084.96
5.5.370.0170.19785.20
5.5.360.0130.21385.19
5.5.350.0200.19785.17
5.5.340.0200.18785.46
5.5.330.0270.21785.54
5.5.320.0330.18785.62
5.5.310.0200.19385.54
5.5.300.0300.13785.55
5.5.290.0130.15385.63
5.5.280.0230.16385.46
5.5.270.0200.20385.45
5.5.260.0200.14785.40
5.5.250.0230.14785.27
5.5.240.0230.14784.78
5.5.230.0130.16085.01
5.5.220.0270.13784.83
5.5.210.0200.15784.98
5.5.200.0070.16784.84
5.5.190.0300.14384.91
5.5.180.0270.14784.79
5.5.160.0200.20084.73
5.5.150.0270.20084.70
5.5.140.0130.19785.01
5.5.130.0170.17084.89
5.5.120.0300.18784.82
5.5.110.0470.20084.90
5.5.100.0230.20384.88
5.5.90.0200.20384.86
5.5.80.0270.20784.75
5.5.70.0170.21384.74
5.5.60.0270.17784.63
5.5.50.0400.17384.85
5.5.40.0200.18784.80
5.5.30.0330.18384.65
5.5.20.0170.16084.86
5.5.10.0270.15084.71
5.5.00.0170.19784.75
5.4.450.0170.15783.85
5.4.440.0200.14783.86
5.4.430.0470.16384.25
5.4.420.0270.13784.25
5.4.410.0270.15084.12
5.4.400.0270.13383.59
5.4.390.0370.19783.75
5.4.380.0330.16383.59
5.4.370.0230.14083.74
5.4.360.0170.16783.84
5.4.350.0170.13083.54
5.4.340.0330.17083.77
5.4.320.0030.19083.89
5.4.310.0500.16783.77
5.4.300.0170.20783.53
5.4.290.0870.13383.68
5.4.280.0200.20783.63
5.4.270.0300.18083.66
5.4.260.0270.19383.58
5.4.250.0200.15083.76
5.4.240.0370.19083.52
5.4.230.0200.19383.58
5.4.220.0270.20783.55
5.4.210.0370.19083.54
5.4.200.0200.20083.74
5.4.190.0300.17783.53
5.4.180.0300.18383.52
5.4.170.0230.19083.53
5.4.160.0170.16383.91
5.4.150.0070.18083.59
5.4.140.0300.18380.99
5.4.130.0130.21380.97
5.4.120.0370.19381.17
5.4.110.0230.20081.10
5.4.100.0230.17380.97
5.4.90.0270.19781.11
5.4.80.0130.15081.14
5.4.70.0230.20781.08
5.4.60.0130.22781.02
5.4.50.0270.19080.97
5.4.40.0330.20080.87
5.4.30.0270.20381.13
5.4.20.0600.09781.10
5.4.10.0230.20380.89
5.4.00.0130.21780.54
5.3.290.0200.21777.84
5.3.280.0300.20077.85
5.3.270.0330.20377.77
5.3.260.0230.21777.69
5.3.250.0130.20777.77
5.3.240.0230.25377.81
5.3.230.0170.22077.94
5.3.220.0170.20777.60
5.3.210.0200.18377.91
5.3.200.0270.21377.75
5.3.190.0270.21077.91
5.3.180.0230.21377.72
5.3.170.0270.19077.75
5.3.160.0130.25377.73
5.3.150.0270.22077.59
5.3.140.0270.20777.82
5.3.130.0270.20777.96
5.3.120.0330.16077.71
5.3.110.0330.22777.94
5.3.100.0330.19777.22
5.3.90.0230.22377.17
5.3.80.0200.22077.29
5.3.70.0270.21377.36
5.3.60.0270.20377.27
5.3.50.0170.21077.14
5.3.40.0200.22077.03
5.3.30.0200.23377.11
5.3.20.0230.23076.88
5.3.10.0170.24376.84
5.3.00.0070.23076.80
5.2.170.0130.04010.93
5.2.160.0030.06311.03
5.2.150.0070.05311.08
5.2.140.0030.06011.16
5.2.130.0030.05711.15
5.2.120.0130.05711.00
5.2.110.0070.06011.02
5.2.100.0070.05711.01
5.2.90.0070.06010.89
5.2.80.0100.05710.88
5.2.70.0100.05311.25
5.2.60.0030.06311.00
5.2.50.0100.05710.95
5.2.40.0100.05311.05
5.2.30.0100.06011.05
5.2.20.0000.06710.87
5.2.10.0030.05710.77
5.2.00.0100.05710.62
5.1.60.0100.0409.93
5.1.50.0130.0379.93
5.1.40.0030.0479.91
5.1.30.0000.05010.33
5.1.20.0070.05710.48
5.1.10.0000.06010.05
5.1.00.0130.0479.99
5.0.50.0000.0478.80
5.0.40.0070.0338.23
5.0.30.0000.0708.18
5.0.20.0070.0438.16
5.0.10.0030.0408.16
5.0.00.0000.0508.15
4.4.90.0000.0277.91
4.4.80.0070.0337.91
4.4.70.0100.0307.91
4.4.60.0030.0177.91
4.4.50.0030.0277.91
4.4.40.0100.0237.91
4.4.30.0070.0307.91
4.4.20.0070.0307.91
4.4.10.0070.0277.91
4.4.00.0030.0577.91
4.3.110.0000.0207.91
4.3.100.0000.0337.91
4.3.90.0000.0377.91
4.3.80.0100.0437.91
4.3.70.0070.0277.91
4.3.60.0070.0307.91
4.3.50.0030.0337.91
4.3.40.0070.0477.91
4.3.30.0000.0337.91
4.3.20.0030.0337.91
4.3.10.0070.0207.91
4.3.00.0030.0337.91

preferences:
37.82 ms | 401 KiB | 5 Q