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(); foreach (range(1, 5000000) as $i) { $collection = new Collection(array( 'foo', 'bar' )); foreach ($collection as $item) { echo memory_get_usage() . "\n"; ob_flush(); } unset($collection); } echo "done\n";

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.00.0040.01214.79
7.3.120.0060.00614.75
7.3.110.0070.01114.43
7.3.100.0030.01314.68
7.3.90.0100.00314.88
7.3.80.0060.00614.71
7.3.70.0100.00714.83
7.3.60.0000.00914.75
7.3.50.0050.00814.71
7.3.40.0040.01114.79
7.3.30.0030.00714.51
7.3.20.0100.00316.61
7.3.10.0030.01116.35
7.3.00.0080.00516.44
7.2.250.0040.01515.01
7.2.240.0000.01914.89
7.2.230.0090.00914.78
7.2.220.0110.00415.02
7.2.210.0080.00414.72
7.2.200.0000.01514.73
7.2.190.0030.00614.78
7.2.180.0070.01115.06
7.2.170.0060.01014.92
7.2.130.0070.00716.82
7.2.120.0110.00516.57
7.2.110.0080.00616.62
7.2.100.0110.00416.53
7.2.90.0100.00316.73
7.2.80.0090.00916.69
7.2.70.0050.01016.66
7.2.60.0090.00616.52
7.2.50.0110.00316.57
7.2.40.0050.00916.64
7.2.30.0050.00716.74
7.2.20.0060.00916.62
7.2.10.0050.00916.69
7.2.00.0040.01016.80
7.1.330.0070.00715.56
7.1.320.0060.00915.78
7.1.310.0060.00915.50
7.1.300.0110.00415.69
7.1.290.0130.00315.57
7.1.280.0000.01515.84
7.1.270.0030.01015.71
7.1.260.0100.00315.59
7.1.250.0080.00515.53
7.1.240.0090.00315.60
7.1.230.0080.00515.53
7.1.220.0040.00715.66
7.1.210.0020.01015.61
7.1.200.0070.00715.70
7.1.190.0090.00515.66
7.1.180.0050.00715.55
7.1.170.0040.01015.54
7.1.160.0040.00615.62
7.1.150.0050.00915.54
7.1.140.0030.00915.65
7.1.130.0030.00915.44
7.1.120.0080.00615.68
7.1.110.0100.00515.77
7.1.100.0060.00415.71
7.1.90.0060.00615.74
7.1.80.0050.00715.52
7.1.70.0090.00616.09
7.1.60.0080.00816.91
7.1.50.0020.01415.72
7.1.40.0050.00715.78
7.1.30.0030.01115.55
7.1.20.0040.01315.53
7.1.10.0080.00615.53
7.1.00.0040.03217.90
7.0.330.0060.00315.05
7.0.320.0070.00715.26
7.0.310.0020.00814.96
7.0.300.0070.00515.37
7.0.290.0030.00915.29
7.0.280.0020.00715.09
7.0.270.0060.00715.20
7.0.260.0030.01015.32
7.0.250.0060.00615.29
7.0.240.0040.00915.19
7.0.230.0080.00615.15
7.0.220.0060.00615.26
7.0.210.0080.00515.21
7.0.200.0060.00715.65
7.0.190.0030.00715.21
7.0.180.0080.00615.33
7.0.170.0050.00515.09
7.0.160.0060.00615.24
7.0.150.0050.00715.07
7.0.140.0060.02717.50
7.0.130.0030.00915.10
7.0.120.0070.00515.23
7.0.110.0030.00715.30
7.0.100.0120.00215.12
7.0.90.0040.00815.34
7.0.80.0030.00615.03
7.0.70.0050.00815.05
7.0.60.0060.02216.81
7.0.50.0070.01516.12
7.0.40.0090.02915.46
7.0.30.0130.02915.52
7.0.20.0150.02915.45
7.0.10.0020.03715.61
7.0.00.0090.03215.49
5.6.380.0380.03678.75
5.6.370.0330.04078.61
5.6.360.0390.03978.83
5.6.350.0360.04178.77
5.6.340.0270.04978.69
5.6.330.0350.04278.72
5.6.320.0400.03778.58
5.6.310.0280.04878.89
5.6.300.0260.05178.76
5.6.290.0490.02778.83
5.6.280.0260.06981.13
5.6.270.0280.04978.98
5.6.260.0270.05078.84
5.6.250.0300.04678.82
5.6.240.0300.03878.72
5.6.230.0340.03778.73
5.6.220.0280.05078.60
5.6.210.0400.06380.84
5.6.200.0320.06680.11
5.6.190.0300.05380.84
5.6.180.0260.07380.78
5.6.170.0370.06480.93
5.6.160.0250.07580.69
5.6.150.0320.07079.96
5.6.140.0380.06680.04
5.6.130.0350.04980.14
5.6.120.0250.06780.93
5.6.110.0240.06181.09
5.6.100.0320.06880.99
5.6.90.0350.06681.01
5.6.80.0360.06280.88
5.6.70.0300.04378.64
5.6.60.0330.04778.54
5.6.50.0300.04578.67
5.6.40.0370.03778.65
5.6.30.0320.04478.65
5.6.20.0240.04978.67
5.6.10.0350.04078.73
5.6.00.0290.04278.68
5.5.380.0240.04975.46
5.5.370.0350.03775.69
5.5.360.0350.03775.56
5.5.350.0290.06978.78
5.5.340.0300.06977.88
5.5.330.0400.06078.64
5.5.320.0470.05278.50
5.5.310.0340.05778.59
5.5.300.0330.06477.90
5.5.290.0280.06677.83
5.5.280.0250.07978.71
5.5.270.0300.07278.66
5.5.260.0310.06278.83
5.5.250.0330.07278.70
5.5.240.0390.06178.62
5.5.230.0270.04875.48
5.5.220.0340.03875.38
5.5.210.0330.04375.34
5.5.200.0350.03775.48
5.5.190.0370.03475.18
5.5.180.0370.03775.49
5.5.170.0230.04975.32
5.5.160.0300.04375.32
5.5.150.0280.04375.63
5.5.140.0290.04175.62
5.5.130.0310.04075.60
5.5.120.0350.03875.47
5.5.110.0270.04375.53
5.5.100.0320.03875.62
5.5.90.0250.04775.23
5.5.80.0310.04975.32
5.5.70.0220.05075.48
5.5.60.0310.04275.54
5.5.50.0320.04075.61
5.5.40.0250.04775.48
5.5.30.0200.04975.48
5.5.20.0250.04675.34
5.5.10.0320.03875.41
5.5.00.0500.02475.48
5.4.450.0620.06278.10
5.4.440.0600.06178.17
5.4.430.0390.06078.24
5.4.420.0770.07078.33
5.4.410.0650.07378.26
5.4.400.0760.05378.26
5.4.390.0760.06978.26
5.4.380.0310.06577.88
5.4.370.0470.05878.09
5.4.360.0430.05677.89
5.4.350.0400.06378.00
5.4.340.0410.07278.01
5.4.330.0250.04575.31
5.4.320.0260.05475.81
5.4.310.0300.05175.94
5.4.300.0310.04775.94
5.4.290.0360.05875.96
5.4.280.0340.06575.99
5.4.270.0360.06275.90
5.4.260.0290.07775.94
5.4.250.0350.06375.99
5.4.240.0280.06475.84
5.4.230.0350.07475.99
5.4.220.0330.06375.84
5.4.210.0290.07075.92
5.4.200.0360.06475.95
5.4.190.0250.07375.98
5.4.180.0260.07175.78
5.4.170.0320.07675.90
5.4.160.0320.07775.94
5.4.150.0350.07575.87
5.4.140.0270.06675.73
5.4.130.0270.07275.90
5.4.120.0360.05375.63
5.4.110.0260.05375.66
5.4.100.0350.04775.79
5.4.90.0300.06275.71
5.4.80.0320.06075.78
5.4.70.0390.07975.78
5.4.60.0270.05775.69
5.4.50.0310.07975.84
5.4.40.0410.07475.77
5.4.30.0400.08775.67
5.4.20.0380.08575.71
5.4.10.0360.07575.80
5.4.00.0440.08675.58
5.3.290.0280.05074.51
5.3.280.0310.07974.40
5.3.270.0390.08174.42
5.3.260.0320.06674.33
5.3.250.0310.08574.38
5.3.240.0290.08474.39
5.3.230.0460.07474.31
5.3.220.0240.07274.34
5.3.210.0340.06574.32
5.3.200.0320.06274.35
5.3.190.0270.07074.35
5.3.180.0290.05574.42
5.3.170.0240.06474.49
5.3.160.0280.07774.48
5.3.150.0280.07374.38
5.3.140.0330.06374.44
5.3.130.0370.05774.43
5.3.120.0360.07774.42
5.3.110.0310.07874.39
5.3.100.0300.08274.12
5.3.90.0280.06974.22
5.3.80.0310.05274.08
5.3.70.0270.05774.06
5.3.60.0270.05674.16
5.3.50.0260.06774.04
5.3.40.0250.06074.03
5.3.30.0320.06474.10
5.3.20.0270.05473.93
5.3.10.0300.05373.89
5.3.00.0260.06573.84
5.2.170.0080.0159.71
5.2.160.0070.0199.71
5.2.150.0040.0209.71
5.2.140.0040.0209.71
5.2.130.0050.0209.70
5.2.120.0050.0219.70
5.2.110.0070.0169.70
5.2.100.0030.0209.70
5.2.90.0070.0169.70
5.2.80.0060.0169.70
5.2.70.0020.0219.70
5.2.60.0040.0209.68
5.2.50.0070.0229.67
5.2.40.0060.0189.66
5.2.30.0060.0189.65
5.2.20.0060.0179.65
5.2.10.0060.0229.62
5.2.00.0060.0159.57
5.1.60.0040.0179.33
5.1.50.0030.0179.33
5.1.40.0090.0139.33
5.1.30.0050.0249.44
5.1.20.0030.0159.45
5.1.10.0030.0179.36
5.1.00.0020.0179.36
5.0.50.0030.0118.85
5.0.40.0030.0128.80
5.0.30.0040.0178.74
5.0.20.0040.0128.73
5.0.10.0070.0248.72
5.0.00.0040.0178.72
4.4.90.0090.0178.46
4.4.80.0050.0148.46
4.4.70.0040.0218.46
4.4.60.0060.0208.46
4.4.50.0020.0128.46
4.4.40.0030.0258.46
4.4.30.0040.0128.46
4.4.20.0070.0128.46
4.4.10.0010.0118.46
4.4.00.0010.0178.46
4.3.110.0020.0118.46
4.3.100.0020.0118.46
4.3.90.0030.0108.46
4.3.80.0030.0148.46
4.3.70.0010.0128.46
4.3.60.0020.0108.46
4.3.50.0010.0118.46
4.3.40.0030.0148.46
4.3.30.0020.0118.46
4.3.20.0020.0108.46
4.3.10.0030.0098.46
4.3.00.0020.0108.89

preferences:
35.57 ms | 401 KiB | 5 Q