3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MapIterator implements IteratorAggregate { private $f; private $inner; public function __construct($f, $inner) { $this->f = $f; $this->inner = $inner; } function current() { echo 'xxx'; return call_user_func($this->f, $this->inner->current()); } function getIterator() { return $this->inner; } } function iter_map($f, $iter) { return new MapIterator($f, $iter); } // example: function times_two($x) { return $x * 2; } $source = new ArrayIterator([0, 1, 2, 3, 4, 5, 6]); print_r(iterator_to_array(iter_map('times_two', $source))); //print_r(iterator_to_array(gen_map('times_two', $source)));

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.60.0040.01118.52
8.3.50.0080.00821.14
8.3.40.0070.00718.71
8.3.30.0070.00720.34
8.3.20.0050.00318.82
8.3.10.0020.00521.09
8.3.00.0030.00522.45
8.2.180.0070.00716.75
8.2.170.0110.00422.96
8.2.160.0180.00320.43
8.2.150.0040.00424.18
8.2.140.0030.00624.66
8.2.130.0000.00726.16
8.2.120.0040.00420.94
8.2.110.0090.00020.94
8.2.100.0080.00817.66
8.2.90.0080.00019.23
8.2.80.0030.00517.97
8.2.70.0080.00017.38
8.2.60.0040.00417.80
8.2.50.0060.00318.07
8.2.40.0040.00418.09
8.2.30.0030.00519.36
8.2.20.0000.00717.59
8.2.10.0000.00717.72
8.2.00.0040.00417.56
8.1.280.0170.00025.92
8.1.270.0080.00023.99
8.1.260.0070.00026.35
8.1.250.0090.00028.09
8.1.240.0000.00922.02
8.1.230.0040.00818.91
8.1.220.0040.00417.74
8.1.210.0050.00318.77
8.1.200.0030.00617.35
8.1.190.0050.00517.23
8.1.180.0040.00418.10
8.1.170.0000.00918.71
8.1.160.0000.00818.91
8.1.150.0070.00318.59
8.1.140.0000.00717.51
8.1.130.0000.00717.71
8.1.120.0040.00417.39
8.1.110.0000.00817.51
8.1.100.0040.00417.45
8.1.90.0040.00417.48
8.1.80.0040.00417.51
8.1.70.0000.00717.44
8.1.60.0040.00417.50
8.1.50.0040.00417.52
8.1.40.0080.00017.43
8.1.30.0050.00317.54
8.1.20.0000.00817.55
8.1.10.0040.00417.49
8.1.00.0040.00417.51
8.0.300.0050.00218.77
8.0.290.0030.00716.75
8.0.280.0000.00718.45
8.0.270.0000.00617.19
8.0.260.0060.00316.71
8.0.250.0040.00417.00
8.0.240.0060.00316.92
8.0.230.0040.00717.03
8.0.220.0030.00316.88
8.0.210.0000.00716.77
8.0.200.0070.00017.01
8.0.190.0040.00416.84
8.0.180.0000.00717.00
8.0.170.0040.00416.88
8.0.160.0000.00716.77
8.0.150.0070.00016.89
8.0.140.0100.00016.77
8.0.130.0030.00313.38
8.0.120.0050.00216.86
8.0.110.0030.00316.81
8.0.100.0000.00716.85
8.0.90.0040.00416.93
8.0.80.0130.00316.85
8.0.70.0070.00016.87
8.0.60.0030.00516.77
8.0.50.0080.00016.79
8.0.30.0140.00517.05
8.0.20.0080.01217.40
8.0.10.0030.00516.91
8.0.00.0080.01016.80
7.4.330.0050.00016.71
7.4.320.0030.00316.52
7.4.300.0000.00616.51
7.4.290.0000.00616.50
7.4.280.0000.00616.49
7.4.270.0030.00316.64
7.4.260.0000.00513.21
7.4.250.0040.00416.48
7.4.240.0000.00716.57
7.4.230.0000.00816.31
7.4.220.0180.00916.54
7.4.210.0070.00816.58
7.4.200.0040.00316.71
7.4.190.0000.00716.38
7.4.160.0040.01316.64
7.4.150.0140.00317.40
7.4.140.0080.01117.86
7.4.130.0070.01416.59
7.4.120.0060.01116.65
7.4.110.0100.00716.48
7.4.100.0070.01016.59
7.4.90.0120.00816.28
7.4.80.0120.00619.39
7.4.70.0110.00716.48
7.4.60.0070.01016.55
7.4.50.0000.00616.55
7.4.40.0030.01322.77
7.4.30.0090.01116.37
7.4.00.0090.00314.89
7.3.330.0000.00513.18
7.3.320.0000.00613.24
7.3.310.0020.00516.13
7.3.300.0000.00716.18
7.3.290.0080.00516.31
7.3.280.0070.01016.31
7.3.270.0090.00917.40
7.3.260.0150.00718.24
7.3.250.0150.00416.51
7.3.240.0160.00016.55
7.3.230.0070.01016.39
7.3.210.0150.00916.50
7.3.200.0100.01319.39
7.3.190.0150.00916.32
7.3.180.0060.01616.42
7.3.170.0070.01016.64
7.3.160.0120.00416.51
7.3.120.0040.00414.82
7.2.330.0040.01416.56
7.2.320.0150.00916.88
7.2.310.0180.00016.63
7.2.300.0120.00616.76
7.2.290.0090.00916.66
7.2.00.0000.01519.54
7.1.100.0060.01218.16
7.1.70.0140.00017.04
7.1.60.0110.01419.17
7.1.50.0130.01316.86
7.1.00.0000.03722.57
7.0.200.0070.00016.88
7.0.140.0030.07721.98
7.0.100.0030.05320.00
7.0.90.0100.06719.83
7.0.80.0070.07719.84
7.0.70.0130.07719.91
7.0.60.0070.08319.91
7.0.50.0100.06720.16
7.0.40.0170.07320.01
7.0.30.0130.08020.13
7.0.20.0100.08020.05
7.0.10.0100.08020.07
7.0.00.0200.07720.09
5.6.280.0130.06321.11
5.6.250.0130.07020.79
5.6.240.0070.07020.61
5.6.230.0030.05020.49
5.6.220.0070.08320.67
5.6.210.0200.06720.71
5.6.200.0070.07320.95
5.6.190.0100.08321.05
5.6.180.0100.08021.07
5.6.170.0070.07321.03
5.6.160.0100.07721.08
5.6.150.0000.08720.92
5.6.140.0100.08021.09
5.6.130.0130.07721.12
5.6.120.0070.08321.03
5.6.110.0230.07021.07
5.6.100.0030.09021.07
5.6.90.0130.08021.00
5.6.80.0100.06320.41
5.6.70.0100.07020.40
5.6.60.0100.07320.47
5.6.50.0100.08020.36
5.6.40.0130.07320.40
5.6.30.0130.06720.47
5.6.20.0230.05720.43
5.6.10.0000.08720.43
5.6.00.0130.07320.40
5.5.380.0100.08020.34
5.5.370.0100.07320.46
5.5.360.0070.08320.36
5.5.350.0070.08320.44
5.5.340.0130.07720.90
5.5.330.0170.07320.65
5.5.320.0170.07320.89
5.5.310.0030.06720.65
5.5.300.0100.07720.86
5.5.290.0100.05720.84
5.5.280.0130.07320.77
5.5.270.0030.07720.89
5.5.260.0170.08020.73
5.5.250.0130.07020.62
5.5.240.0100.07320.20
5.5.230.0100.04320.29
5.5.220.0170.06720.30
5.5.210.0070.07020.25
5.5.200.0200.06020.28
5.5.190.0100.06720.13
5.5.180.0070.07320.12
5.5.160.0070.08020.28
5.5.150.0100.07320.15
5.5.140.0070.06320.16
5.5.130.0030.08320.19
5.5.120.0200.03320.09
5.5.110.0070.05020.13
5.5.100.0070.07720.17
5.5.90.0100.07020.16
5.5.80.0070.08320.14
5.5.70.0100.07320.13
5.5.60.0070.08020.09
5.5.50.0170.07020.07
5.5.40.0000.08020.00
5.5.30.0100.08020.15
5.5.20.0100.08020.09
5.5.10.0070.04719.96
5.5.00.0170.06320.06
5.4.450.0130.07719.18
5.4.440.0130.08019.36
5.4.430.0170.07019.35
5.4.420.0000.05319.45
5.4.410.0070.07319.23
5.4.400.0070.07318.86
5.4.390.0030.07719.04
5.4.380.0100.04719.22
5.4.370.0030.04319.03
5.4.360.0130.04019.04
5.4.350.0100.06719.14
5.4.340.0130.07318.95
5.4.320.0070.07718.95
5.4.310.0170.03719.04
5.4.300.0130.07019.20
5.4.290.0170.07019.12
5.4.280.0100.08319.03
5.4.270.0100.07019.18
5.4.260.0070.07718.89
5.4.250.0000.08018.89
5.4.240.0030.07718.84
5.4.230.0070.07319.14
5.4.220.0100.06719.02
5.4.210.0100.07018.84
5.4.200.0100.08019.03
5.4.190.0100.07318.87
5.4.180.0030.08019.16
5.4.170.0130.04019.04
5.4.160.0100.07019.11
5.4.150.0000.08319.11
5.4.140.0200.03316.48
5.4.130.0030.08316.46
5.4.120.0070.07716.55
5.4.110.0170.05716.40
5.4.100.0100.07316.45
5.4.90.0200.04716.35
5.4.80.0030.07716.52
5.4.70.0100.06716.43
5.4.60.0100.04716.37
5.4.50.0170.03716.49
5.4.40.0170.04316.35
5.4.30.0100.06716.35
5.4.20.0070.06016.49
5.4.10.0070.07716.43
5.4.00.0100.04015.89
5.3.290.0070.07714.66
5.3.280.0100.07714.58
5.3.270.0100.07314.55
5.3.260.0000.08014.75
5.3.250.0000.07714.67
5.3.240.0070.07014.54
5.3.230.0200.06714.72
5.3.220.0130.06714.50
5.3.210.0130.05714.60
5.3.200.0030.07714.68
5.3.190.0000.05014.56
5.3.180.0100.07014.63
5.3.170.0100.07714.68
5.3.160.0100.04314.58
5.3.150.0100.07314.56
5.3.140.0100.07314.61
5.3.130.0030.08314.63
5.3.120.0070.07714.59
5.3.110.0070.07314.67
5.3.100.0100.07313.99
5.3.90.0070.08014.10
5.3.80.0100.05014.16
5.3.70.0030.05014.07
5.3.60.0130.06714.13
5.3.50.0070.07013.94
5.3.40.0100.07013.96
5.3.30.0100.04313.95
5.3.20.0000.07713.63
5.3.10.0130.05713.66
5.3.00.0030.06713.68
5.2.170.0030.03711.19
5.2.160.0070.05711.18
5.2.150.0170.05011.27
5.2.140.0070.06011.21
5.2.130.0070.05011.17
5.2.120.0030.05310.97
5.2.110.0230.02311.03
5.2.100.0070.05711.16
5.2.90.0000.06011.12
5.2.80.0100.06011.04
5.2.70.0070.06711.19
5.2.60.0070.05311.18
5.2.50.0000.03310.92
5.2.40.0130.05011.03
5.2.30.0030.06011.12
5.2.20.0000.05010.90
5.2.10.0030.03710.95
5.2.00.0000.03010.86
5.1.60.0030.04310.65
5.1.50.0030.02710.65
5.1.40.0030.02310.65
5.1.30.0000.03010.65
5.1.20.0000.03010.65
5.1.10.0030.02010.65
5.1.00.0030.02310.65
5.0.50.0000.02010.65
5.0.40.0030.04010.65
5.0.30.0030.02710.65
5.0.20.0030.04310.65
5.0.10.0000.04010.65
5.0.00.0030.05710.65
4.4.90.0030.03710.65
4.4.80.0030.01710.65
4.4.70.0000.01710.65
4.4.60.0000.01710.65
4.4.50.0000.01710.65
4.4.40.0000.02710.65
4.4.30.0030.01710.65
4.4.20.0030.01710.65
4.4.10.0000.01310.65
4.4.00.0000.02710.65
4.3.110.0000.01710.65
4.3.100.0000.03710.65
4.3.90.0030.03310.65
4.3.80.0000.05310.65
4.3.70.0000.03710.65
4.3.60.0030.03310.65
4.3.50.0030.01310.65
4.3.40.0070.04010.65
4.3.30.0000.03310.65
4.3.20.0000.02310.65
4.3.10.0000.02010.65
4.3.00.0030.01310.65

preferences:
51.22 ms | 401 KiB | 5 Q