3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Collection extends ArrayObject { protected $iterator; public function getIterator() { // Well, this is a heavy object to make, let's memoize it if (!isset($this->iterator)) { $this->iterator = new ArrayIterator($this); } return $this->iterator; } } gc_enable(); $base = memory_get_usage(); foreach (range(1, 250000) as $i) { $collection = new Collection(array( 'foo', 'bar' )); foreach ($collection as $item) { } unset($collection); gc_collect_cycles(); if ($i % 500 === 0) { var_dump(memory_get_usage() - $base); } }

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.0030.24427.21
7.1.70.0070.26724.91
7.1.60.0170.29925.13
7.1.50.0000.23824.55
7.1.00.0100.40730.39
7.0.200.0070.25024.41
7.0.140.0070.36029.98
7.0.100.0370.30727.44
7.0.90.0070.31027.62
7.0.80.0200.39327.48
7.0.70.0630.32327.39
7.0.60.0130.31327.34
7.0.50.0600.31027.69
7.0.40.0270.32027.61
7.0.30.0570.26727.59
7.0.20.0530.35027.52
7.0.10.0230.30027.61
7.0.00.0600.32727.42
5.6.280.0200.56355.64
5.6.250.0230.48055.45
5.6.240.0430.50355.45
5.6.230.0130.50355.29
5.6.220.0130.11384.52
5.6.210.0270.17084.46
5.6.200.0300.14085.02
5.6.190.0170.12385.03
5.6.180.0370.09384.87
5.6.170.0230.15384.95
5.6.160.0300.16085.07
5.6.150.0270.15385.05
5.6.140.0200.16084.86
5.6.130.0400.09084.85
5.6.120.0330.14384.85
5.6.110.0170.11084.83
5.6.100.0130.16384.99
5.6.90.0230.12784.85
5.6.80.0130.12384.28
5.6.70.0330.09384.21
5.6.60.0230.10384.32
5.6.50.0130.12084.29
5.6.40.0370.07384.37
5.6.30.0170.11784.32
5.6.20.0230.12084.30
5.6.10.0200.08784.27
5.6.00.0300.07784.32
5.5.380.0170.55055.24
5.5.370.0130.52355.23
5.5.360.0170.14084.31
5.5.350.0270.15784.25
5.5.340.0200.14784.72
5.5.330.0370.13784.81
5.5.320.0200.12384.67
5.5.310.0200.12784.66
5.5.300.0130.14784.68
5.5.290.0230.16784.67
5.5.280.0200.09784.79
5.5.270.0230.15784.82
5.5.260.0230.15084.75
5.5.250.0330.10084.59
5.5.240.0300.10084.21
5.5.230.0400.10384.19
5.5.220.0270.09084.14
5.5.210.0270.11384.11
5.5.200.0100.13084.13
5.5.190.0070.10784.16
5.5.180.0200.12083.98
5.5.160.0530.10383.89
5.5.150.0270.08784.10
5.5.140.0070.10784.17
5.5.130.0270.12084.13
5.5.120.0300.10784.11
5.5.110.0230.14384.14
5.5.100.0130.10084.05
5.5.90.0270.09384.00
5.5.80.0200.09783.90
5.5.70.0270.08783.95
5.5.60.0370.14083.98
5.5.50.0330.14384.04
5.5.40.0300.15384.05
5.5.30.0130.14084.00
5.5.20.0270.11384.04
5.5.10.0200.15783.87
5.5.00.0330.14783.93
5.4.450.0370.15783.22
5.4.440.0230.13083.26
5.4.430.0270.17783.00
5.4.420.0400.13783.19
5.4.410.0330.15383.14
5.4.400.0170.11782.86
5.4.390.0230.14783.04
5.4.380.0130.09782.72
5.4.370.0170.11383.04
5.4.360.0200.10382.72
5.4.350.0170.12382.86
5.4.340.0070.10782.88
5.4.320.0270.08782.72
5.4.310.0270.09782.89
5.4.300.0300.10782.88
5.4.290.0270.08782.88
5.4.280.0130.10082.86
5.4.270.0100.10782.86
5.4.260.0170.09382.85
5.4.250.0130.09782.86
5.4.240.0270.11082.72
5.4.230.0070.11082.84
5.4.220.0270.15382.77
5.4.210.0270.10382.93
5.4.200.0230.11782.71
5.4.190.0300.16382.93
5.4.180.0270.16382.87
5.4.170.0200.11782.71
5.4.160.0370.15382.99
5.4.150.0400.12782.76
5.4.140.0300.16780.29
5.4.130.0300.16780.14
5.4.120.0130.14780.10
5.4.110.0230.16080.18
5.4.100.0430.09380.36
5.4.90.0200.14080.23
5.4.80.0200.11780.31
5.4.70.0370.14780.19
5.4.60.0230.11080.20
5.4.50.0130.15380.14
5.4.40.0300.10380.29
5.4.30.0370.13380.27
5.4.20.0170.17380.29
5.4.10.0200.13780.29
5.4.00.0270.13379.62
5.3.290.0170.09376.16
5.3.280.0230.11375.97
5.3.270.0170.11076.05
5.3.260.0230.13076.12
5.3.250.0230.10775.99
5.3.240.0230.10775.95
5.3.230.0300.09776.04
5.3.220.0130.17376.05
5.3.210.0170.11775.91
5.3.200.0270.10375.91
5.3.190.0300.16075.92
5.3.180.0270.10776.05
5.3.170.0130.17375.95
5.3.160.0100.11776.02
5.3.150.0270.16075.92
5.3.140.0270.12775.90
5.3.130.0130.12075.90
5.3.120.0200.15775.96
5.3.110.0100.14075.90
5.3.100.0230.14075.47
5.3.90.0130.11775.36
5.3.80.0200.10775.36
5.3.70.0170.11775.37
5.3.60.0200.12775.31
5.3.50.0370.13375.39
5.3.40.0330.14375.31
5.3.30.0430.08775.28
5.3.20.0300.15375.09
5.3.10.0502.43748.15
5.3.00.0502.40348.18
5.2.170.0070.04311.75
5.2.160.0030.05711.75
5.2.150.0030.03011.75
5.2.140.0030.05711.75
5.2.130.0070.06011.75
5.2.120.0000.06311.75
5.2.110.0030.03011.75
5.2.100.0070.02011.75
5.2.90.0030.04311.75
5.2.80.0030.04711.75
5.2.70.0000.06711.75
5.2.60.0070.04011.75
5.2.50.0000.03011.75
5.2.40.0070.02711.75
5.2.30.0070.02711.75
5.2.20.0030.06011.75
5.2.10.0030.02711.75
5.2.00.0070.02311.75
5.1.60.0070.04311.75
5.1.50.0030.03311.75
5.1.40.0030.05311.75
5.1.30.0030.02311.75
5.1.20.0070.02011.75
5.1.10.0030.05011.75
5.1.00.0100.02011.75
5.0.50.0000.03711.75
5.0.40.0100.02711.75
5.0.30.0000.05311.75
5.0.20.0070.04011.75
5.0.10.0030.03311.75
5.0.00.0030.05711.75
4.4.90.0000.01311.75
4.4.80.0070.03011.75
4.4.70.0030.03311.75
4.4.60.0000.01311.75
4.4.50.0000.01711.75
4.4.40.0030.02011.75
4.4.30.0000.03011.75
4.4.20.0000.03711.75
4.4.10.0000.03011.75
4.4.00.0030.05311.75
4.3.110.0030.02011.75
4.3.100.0000.03011.75
4.3.90.0000.01711.75
4.3.80.0000.03011.75
4.3.70.0100.00711.75
4.3.60.0000.02711.75
4.3.50.0000.03311.75
4.3.40.0030.02711.75
4.3.30.0000.01711.75
4.3.20.0000.03311.75
4.3.10.0070.03011.75
4.3.00.0030.03011.75

preferences:
37.37 ms | 401 KiB | 5 Q