3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Everything you enter here will be executed by our servers. Try it! function iterator_compose(\Traversable $source, $steps) { foreach ($steps as $step) { $gen = $source; var_dump($step); if (is_array($step) and !is_callable($step)) { $g = array_shift($step); array_unshift($step, $gen); if (class_exists($g)) { $class = new \ReflectionClass($className); $gen = $class->newInstanceArgs($step); } else if (is_callable($g)) { $gen = call_user_func_array($g, $step); } } else if (is_callable($step)) { $gen = $step($gen); } } return $gen; } function iterator_chunk(\Traversable $it, $chunkSize) { $it->rewind(); $chunk = []; $steps = range(1, $chunkSize); while (true) { foreach ($steps as $_) { if (!$it->valid()) { break 2; } $chunk[] = $it->current(); $it->next(); } yield $chunk; $chunk = []; } if ($chunk) { yield $chunk; } } $steps = [ function($it) { foreach ($it as $val) { echo "Value: $val\n"; yield $val; } }, ["iterator_chunk", 32], ]; $it = iterator_compose(new \ArrayIterator(range(0, 127)), $steps); foreach ($it as $i => $c) { echo "====== Chunk $i ======\n"; var_export($c); echo "\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)
8.3.60.0150.00416.63
8.3.50.0140.00318.14
8.3.40.0040.01118.93
8.3.30.0140.00019.27
8.3.20.0040.00420.34
8.3.10.0000.00823.53
8.3.00.0080.00019.25
8.2.180.0040.01118.25
8.2.170.0090.00622.96
8.2.160.0150.00020.34
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0030.00522.27
8.2.110.0070.00322.00
8.2.100.0070.00417.97
8.2.90.0030.00518.94
8.2.80.0000.00918.03
8.2.70.0000.01017.75
8.2.60.0040.00418.04
8.2.50.0030.00618.07
8.2.40.0030.00618.22
8.2.30.0080.00018.02
8.2.20.0000.00917.75
8.2.10.0000.00718.20
8.2.00.0090.00017.88
8.1.270.0030.00622.05
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0030.00723.96
8.1.230.0040.00818.96
8.1.220.0040.00417.74
8.1.210.0030.00618.77
8.1.200.0060.00317.36
8.1.190.0000.00817.55
8.1.180.0030.00518.10
8.1.170.0040.00418.46
8.1.160.0050.00221.95
8.1.150.0050.00318.68
8.1.140.0040.00417.41
8.1.130.0030.00317.90
8.1.120.0000.00717.33
8.1.110.0000.00717.50
8.1.100.0040.00417.42
8.1.90.0030.00517.38
8.1.80.0000.00717.32
8.1.70.0000.00717.40
8.1.60.0080.00017.60
8.1.50.0000.00817.59
8.1.40.0000.00817.61
8.1.30.0030.00517.55
8.1.20.0030.00517.69
8.1.10.0040.00417.63
8.1.00.0000.00917.46
8.0.300.0070.00018.77
8.0.290.0080.00017.05
8.0.280.0070.00018.52
8.0.270.0000.00717.29
8.0.260.0030.00516.93
8.0.250.0030.00316.95
8.0.240.0040.00417.09
8.0.230.0030.00317.05
8.0.220.0040.00417.04
8.0.210.0000.00717.03
8.0.200.0040.00417.00
8.0.190.0100.00016.99
8.0.180.0030.00516.91
8.0.170.0040.00417.07
8.0.160.0040.00416.98
8.0.150.0040.00416.82
8.0.140.0080.00016.96
8.0.130.0040.00413.41
8.0.120.0000.00816.85
8.0.110.0030.00516.89
8.0.100.0040.00416.97
8.0.90.0050.00217.06
8.0.80.0000.01516.97
8.0.70.0020.00516.84
8.0.60.0000.00816.84
8.0.50.0000.00716.87
8.0.30.0130.00717.13
8.0.20.0160.00517.40
8.0.10.0040.00417.05
8.0.00.0110.01016.91
7.4.330.0020.00215.03
7.4.320.0060.00016.45
7.4.300.0000.00716.52
7.4.290.0070.00016.63
7.4.280.0080.00016.52
7.4.270.0050.00316.64
7.4.260.0000.00716.67
7.4.250.0070.00016.42
7.4.240.0080.00016.56
7.4.230.0000.00716.74
7.4.220.0030.02316.66
7.4.210.0080.00716.61
7.4.200.0040.00416.46
7.4.190.0000.00816.51
7.4.160.0140.00516.51
7.4.150.0030.01417.40
7.4.140.0140.00417.86
7.4.130.0090.00816.50
7.4.120.0110.01016.60
7.4.110.0070.01116.40
7.4.100.0080.01016.65
7.4.90.0070.01016.50
7.4.80.0110.01119.39
7.4.70.0060.01116.53
7.4.60.0150.00716.44
7.4.50.0040.00416.14
7.4.40.0030.00822.77
7.4.30.0140.00316.35
7.4.10.0090.00914.97
7.4.00.0030.01214.90
7.3.330.0030.00313.45
7.3.320.0030.00313.44
7.3.310.0000.00816.32
7.3.300.0080.00016.51
7.3.290.0120.00316.36
7.3.280.0120.00616.46
7.3.270.0120.00617.40
7.3.260.0100.01016.39
7.3.250.0160.00316.60
7.3.240.0070.01116.59
7.3.230.0030.01316.39
7.3.210.0130.00716.69
7.3.200.0080.01119.39
7.3.190.0080.01116.63
7.3.180.0130.00316.34
7.3.170.0060.01116.52
7.3.160.0060.01116.43
7.3.130.0070.01114.77
7.3.120.0060.01015.03
7.3.110.0060.01314.49
7.3.100.0030.01214.34
7.3.90.0040.01114.74
7.3.80.0030.01415.08
7.3.70.0000.01414.53
7.3.60.0090.00614.66
7.3.50.0050.00514.38
7.3.40.0090.00614.66
7.3.30.0090.00914.84
7.3.20.0040.00716.51
7.3.10.0090.00316.52
7.3.00.0110.00716.32
7.2.330.0080.01116.68
7.2.320.0150.00316.70
7.2.310.0100.01016.48
7.2.300.0120.00816.76
7.2.290.0030.01616.62
7.2.260.0130.00014.89
7.2.250.0030.01514.75
7.2.240.0060.01214.95
7.2.230.0040.01114.83
7.2.220.0040.00714.87
7.2.210.0070.00715.05
7.2.200.0000.00914.71
7.2.190.0040.01115.15
7.2.180.0100.00315.03
7.2.170.0070.01114.82
7.2.160.0040.01515.09
7.2.150.0030.00616.79
7.2.140.0100.00316.76
7.2.130.0030.01016.93
7.2.120.0030.01616.75
7.2.110.0060.00916.91
7.2.100.0140.00016.91
7.2.90.0040.00716.59
7.2.80.0030.01016.90
7.2.70.0040.01216.51
7.2.60.0030.00716.92
7.2.50.0100.00716.93
7.2.40.0060.00617.02
7.2.30.0030.00816.88
7.2.20.0070.01116.37
7.2.10.0030.00616.66
7.2.00.0030.00818.04
7.1.330.0100.00315.47
7.1.320.0070.00715.54
7.1.310.0100.00615.46
7.1.300.0070.00715.48
7.1.290.0060.00915.49
7.1.280.0030.01415.70
7.1.270.0110.00015.71
7.1.260.0000.01715.63
7.1.250.0090.00615.50
7.1.240.0030.00915.73
7.1.230.0060.00615.51
7.1.220.0030.01015.52
7.1.210.0060.00915.66
7.1.200.0030.00915.68
7.1.190.0060.01215.57
7.1.180.0060.01215.43
7.1.170.0070.01115.46
7.1.160.0070.00715.71
7.1.150.0050.00515.60
7.1.140.0040.00715.69
7.1.130.0090.00615.50
7.1.120.0080.00015.78
7.1.110.0060.00315.80
7.1.100.0040.00917.17
7.1.90.0000.01515.55
7.1.80.0000.01215.79
7.1.70.0060.00616.50
7.1.60.0100.00817.63
7.1.50.0050.01316.18
7.1.40.0090.00615.56
7.1.30.0060.00615.73
7.1.20.0030.00715.73
7.1.10.0030.00915.28
7.1.00.0050.04119.13
7.0.330.0030.01215.42
7.0.320.0060.00614.92
7.0.310.0060.00615.38
7.0.300.0060.00315.02
7.0.290.0030.01015.23
7.0.280.0040.00815.20
7.0.270.0070.00715.14
7.0.260.0060.00315.21
7.0.250.0030.00915.20
7.0.240.0060.00915.42
7.0.230.0040.00815.45
7.0.220.0000.01415.25
7.0.210.0060.00615.26
7.0.200.0070.00516.12
7.0.190.0070.00715.59
7.0.180.0030.01315.16
7.0.170.0090.00615.42
7.0.160.0030.00615.33
7.0.150.0110.00315.35
7.0.140.0060.03918.60
7.0.130.0000.01415.44
7.0.120.0060.00615.34
7.0.110.0080.04017.70
7.0.100.0100.04017.63
7.0.90.0080.04417.58
7.0.80.0070.04317.63
7.0.70.0030.04717.65
7.0.60.0100.04717.50
7.0.50.0070.03517.80
7.0.40.0110.03816.46
7.0.30.0080.04316.57
7.0.20.0070.04216.61
7.0.10.0070.02516.48
7.0.00.0050.04616.63
5.6.400.0040.01514.23
5.6.390.0110.00414.27
5.6.380.0040.01114.18
5.6.370.0040.01114.55
5.6.360.0080.00614.36
5.6.350.0060.00614.59
5.6.340.0030.01014.43
5.6.330.0040.01213.94
5.6.320.0060.00914.44
5.6.310.0060.00613.88
5.6.300.0100.00614.78
5.6.290.0000.01514.56
5.6.280.0060.03817.60
5.6.270.0090.00614.25
5.6.260.0050.04517.66
5.6.250.0100.04017.58
5.6.240.0050.03017.24
5.6.230.0070.04317.53
5.6.220.0050.04517.49
5.6.210.0060.04217.46
5.6.200.0090.02717.38
5.6.190.0070.04617.42
5.6.180.0070.04017.43
5.6.170.0030.04017.52
5.6.160.0100.04017.51
5.6.150.0070.04217.53
5.6.140.0120.04017.57
5.6.130.0070.03317.35
5.6.120.0050.04317.55
5.6.110.0020.04517.43
5.6.100.0050.04517.50
5.6.90.0060.04417.43
5.6.80.0070.03517.12
5.6.70.0050.04517.22
5.6.60.0060.03517.13
5.6.50.0080.04217.26
5.6.40.0070.04217.15
5.6.30.0000.04617.24
5.6.20.0070.04317.38
5.6.10.0090.04217.36
5.6.00.0100.02317.14
5.5.380.0080.04516.03
5.5.370.0020.04715.99
5.5.360.0090.04316.17
5.5.350.0040.04216.13
5.5.340.0070.04216.37
5.5.330.0060.04116.24
5.5.320.0130.04316.31
5.5.310.0070.04816.12
5.5.300.0050.04116.24
5.5.290.0060.03016.14
5.5.280.0060.04116.29
5.5.270.0070.04516.12
5.5.260.0100.02516.09
5.5.250.0110.03515.92
5.5.240.0150.03515.84
5.5.230.0020.03815.82
5.5.220.0060.04015.87
5.5.210.0100.03715.78
5.5.200.0090.04015.95
5.5.190.0050.04315.81
5.5.180.0020.04915.88
5.5.170.0120.00314.00
5.5.160.0030.04815.83
5.5.150.0070.02715.79
5.5.140.0020.04415.96
5.5.130.0050.04415.74
5.5.120.0050.02715.96
5.5.110.0070.04215.88
5.5.100.0050.04415.89
5.5.90.0070.04215.84
5.5.80.0050.03915.76
5.5.70.0050.03015.92
5.5.60.0030.04015.92
5.5.50.0050.04015.81
5.5.40.0030.03515.96
5.5.30.0050.04415.71
5.5.20.0060.04315.88
5.5.10.0080.02815.81
5.5.00.0090.03015.76
5.4.450.0080.04315.05
5.4.440.0030.04515.05
5.4.430.0070.03915.16
5.4.420.0110.03715.23
5.4.410.0100.03514.95
5.4.400.0070.02515.03
5.4.390.0040.04115.02
5.4.380.0020.03015.10
5.4.370.0040.04314.74
5.4.360.0030.04214.80
5.4.350.0020.04114.87
5.4.340.0050.04014.95
5.4.330.0100.00310.80
5.4.320.0070.03814.82
5.4.310.0030.04414.79
5.4.300.0060.03014.86
5.4.290.0060.03014.91
5.4.280.0060.03615.04
5.4.270.0100.03414.92
5.4.260.0050.04215.01
5.4.250.0050.04114.99
5.4.240.0080.03514.75
5.4.230.0060.04114.83
5.4.220.0050.03914.91
5.4.210.0030.03014.93
5.4.200.0100.03514.89
5.4.190.0080.03714.96
5.4.180.0080.03514.88
5.4.170.0080.03714.90
5.4.160.0050.04314.74
5.4.150.0100.03714.84
5.4.140.0020.03013.51
5.4.130.0050.02713.60
5.4.120.0140.03213.62
5.4.110.0090.03713.69
5.4.100.0060.03813.71
5.4.90.0100.03713.64
5.4.80.0080.03813.85
5.4.70.0070.03413.53
5.4.60.0090.03613.46
5.4.50.0060.02213.69
5.4.40.0090.03313.70
5.4.30.0030.02913.66
5.4.20.0050.04013.56
5.4.10.0050.03313.42
5.4.00.0080.03613.17
5.3.290.0050.03612.46
5.3.280.0030.04012.43
5.3.270.0030.04412.47
5.3.260.0080.03712.40
5.3.250.0050.03812.45
5.3.240.0110.03812.38
5.3.230.0070.03912.54
5.3.220.0050.04412.38
5.3.210.0060.04012.48
5.3.200.0130.03012.54
5.3.190.0030.04412.43
5.3.180.0050.04012.42
5.3.170.0050.02512.51
5.3.160.0020.02912.45
5.3.150.0080.03512.39
5.3.140.0120.03312.49
5.3.130.0020.04212.58
5.3.120.0050.04012.42
5.3.110.0000.04312.45
5.3.100.0050.02912.24
5.3.90.0040.01812.19
5.3.80.0050.03812.12
5.3.70.0070.03512.10
5.3.60.0070.03812.25
5.3.50.0050.04212.13
5.3.40.0050.04212.17
5.3.30.0030.04112.10
5.3.20.0020.02711.96
5.3.10.0050.03011.91
5.3.00.0060.03311.90
5.2.170.0100.05311.17
5.2.160.0070.03311.11
5.2.150.0130.02311.16
5.2.140.0000.07311.27
5.2.130.0000.03011.09
5.2.120.0030.03711.25
5.2.110.0100.05311.18
5.2.100.0100.05311.12
5.2.90.0030.06010.96
5.2.80.0030.06311.18
5.2.70.0000.04711.09
5.2.60.0070.05711.28
5.2.50.0030.05711.01
5.2.40.0100.05310.86
5.2.30.0070.06011.06
5.2.20.0100.04311.11
5.2.10.0100.05711.01
5.2.00.0000.07010.61
5.1.60.0100.04710.00
5.1.50.0070.0279.96
5.1.40.0100.0439.98
5.1.30.0070.03010.57
5.1.20.0030.05710.49
5.1.10.0030.05710.07
5.1.00.0070.05010.07
5.0.50.0030.0509.69
5.0.40.0000.0409.69
5.0.30.0030.0579.69
5.0.20.0070.0309.69
5.0.10.0000.0479.69
5.0.00.0000.0609.69
4.4.90.0070.0309.69
4.4.80.0000.0279.69
4.4.70.0030.0379.69
4.4.60.0000.0409.69
4.4.50.0030.0339.69
4.4.40.0030.0479.69
4.4.30.0100.0209.69
4.4.20.0130.0239.69
4.4.10.0030.0339.69
4.4.00.0030.0539.69
4.3.110.0000.0379.69
4.3.100.0030.0339.69
4.3.90.0000.0379.69
4.3.80.0070.0409.69
4.3.70.0070.0309.69
4.3.60.0070.0309.69
4.3.50.0030.0279.69
4.3.40.0030.0509.69
4.3.30.0030.0339.69
4.3.20.0000.0379.69
4.3.10.0000.0279.69
4.3.00.0030.0309.69

preferences:
59.89 ms | 400 KiB | 5 Q