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($source, $steps) { foreach (array_reverse($steps) as $step) { $gen = $source; 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 = [ ["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.0090.00918.22
8.3.50.0130.00421.99
8.3.40.0040.01218.88
8.3.30.0060.00918.92
8.3.20.0050.00318.73
8.3.10.0110.00421.17
8.3.00.0040.00423.69
8.2.180.0130.00718.66
8.2.170.0120.00322.96
8.2.160.0070.00720.38
8.2.150.0050.00324.18
8.2.140.0040.01124.66
8.2.130.0080.00026.16
8.2.120.0060.00319.61
8.2.110.0080.00321.07
8.2.100.0070.00418.03
8.2.90.0050.00319.22
8.2.80.0040.00417.97
8.2.70.0000.00817.75
8.2.60.0110.00017.93
8.2.50.0000.00818.10
8.2.40.0040.00420.61
8.2.30.0040.00419.88
8.2.20.0000.00817.72
8.2.10.0080.00017.70
8.2.00.0080.00417.89
8.1.280.0000.01425.92
8.1.270.0000.00723.99
8.1.260.0110.00726.35
8.1.250.0140.00328.09
8.1.240.0060.00321.43
8.1.230.0080.00417.57
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0000.00917.35
8.1.190.0040.00417.35
8.1.180.0000.00918.10
8.1.170.0000.00918.30
8.1.160.0040.00418.78
8.1.150.0040.00418.57
8.1.140.0000.00817.48
8.1.130.0070.00017.82
8.1.120.0050.00217.38
8.1.110.0040.00417.43
8.1.100.0000.00817.48
8.1.90.0000.00717.47
8.1.80.0000.00817.47
8.1.70.0000.00717.37
8.1.60.0040.00417.55
8.1.50.0040.00417.37
8.1.40.0000.00817.52
8.1.30.0000.00917.56
8.1.20.0050.00317.63
8.1.10.0030.00617.60
8.1.00.0040.00417.58
8.0.300.0040.00418.77
8.0.290.0080.00016.75
8.0.280.0070.00418.45
8.0.270.0030.00317.28
8.0.260.0070.00017.02
8.0.250.0000.00816.96
8.0.240.0000.00817.06
8.0.230.0000.00716.93
8.0.220.0050.00316.94
8.0.210.0000.00716.87
8.0.200.0040.00417.02
8.0.190.0000.00716.90
8.0.180.0000.00816.98
8.0.170.0000.00717.00
8.0.160.0040.00417.03
8.0.150.0030.00616.85
8.0.140.0070.00317.00
8.0.130.0050.00013.43
8.0.120.0040.00416.93
8.0.110.0000.00716.95
8.0.100.0050.00317.03
8.0.90.0000.00717.03
8.0.80.0100.00716.99
8.0.70.0040.00416.87
8.0.60.0040.00416.97
8.0.50.0060.00316.98
8.0.30.0080.01817.27
8.0.20.0060.01117.40
8.0.10.0040.00417.00
8.0.00.0110.01116.91
7.4.330.0050.00014.81
7.4.320.0000.00616.46
7.4.300.0030.00316.58
7.4.290.0030.00316.55
7.4.280.0050.00216.45
7.4.270.0000.00716.48
7.4.260.0000.00513.30
7.4.250.0050.00316.42
7.4.240.0000.00716.59
7.4.230.0060.00316.64
7.4.220.0070.00916.52
7.4.210.0070.00916.54
7.4.200.0000.00816.43
7.4.190.0000.00916.48
7.4.160.0080.00816.50
7.4.150.0030.01317.40
7.4.140.0100.01217.86
7.4.130.0100.00716.61
7.4.120.0070.01316.48
7.4.110.0080.01516.59
7.4.100.0100.00716.48
7.4.90.0060.01216.41
7.4.80.0110.00719.37
7.4.70.0130.00316.51
7.4.60.0070.01016.33
7.4.50.0030.00616.57
7.4.40.0090.00622.27
7.4.30.0040.01316.59
7.4.10.0060.00914.99
7.4.00.0060.01214.92
7.3.330.0000.00513.32
7.3.320.0050.00013.40
7.3.310.0040.00416.45
7.3.300.0070.00016.29
7.3.290.0060.00816.45
7.3.280.0080.00816.44
7.3.270.0100.00617.40
7.3.260.0130.01118.24
7.3.250.0080.01116.43
7.3.240.0090.00916.40
7.3.230.0060.01116.61
7.3.210.0150.00916.66
7.3.200.0110.00519.39
7.3.190.0110.00616.59
7.3.180.0090.00716.41
7.3.170.0130.00516.48
7.3.160.0060.01016.61
7.3.130.0070.01215.00
7.3.120.0080.00714.94
7.3.110.0050.01414.85
7.3.100.0060.00914.87
7.3.90.0050.01114.95
7.3.80.0100.00514.76
7.3.70.0080.00614.93
7.3.60.0030.01114.98
7.3.50.0080.00314.89
7.3.40.0050.00714.94
7.3.30.0070.00614.97
7.3.20.0040.01016.44
7.3.10.0050.00616.45
7.3.00.0090.00516.75
7.2.330.0040.01416.94
7.2.320.0070.01116.71
7.2.310.0100.00716.65
7.2.300.0080.01116.71
7.2.290.0170.00316.83
7.2.260.0070.01315.20
7.2.250.0120.00715.17
7.2.240.0070.00915.09
7.2.230.0100.00715.19
7.2.220.0110.00515.09
7.2.210.0080.00515.01
7.2.200.0020.01314.98
7.2.190.0060.00815.22
7.2.180.0030.01315.04
7.2.170.0100.00715.17
7.2.160.0030.01015.06
7.2.150.0070.00516.89
7.2.140.0050.01016.94
7.2.130.0050.00716.84
7.2.120.0050.00516.88
7.2.110.0080.00616.83
7.2.100.0020.01216.84
7.2.90.0020.01017.02
7.2.80.0090.00716.85
7.2.70.0070.00616.97
7.2.60.0050.01016.95
7.2.50.0080.00616.89
7.2.40.0150.00316.90
7.2.30.0040.00816.97
7.2.20.0090.00517.06
7.2.10.0050.01316.65
7.2.00.0090.00617.81
7.1.330.0020.01315.88
7.1.320.0110.00315.91
7.1.310.0050.01116.02
7.1.300.0080.00715.75
7.1.290.0030.01115.71
7.1.280.0050.01215.75
7.1.270.0030.00915.68
7.1.260.0080.00515.76
7.1.250.0070.00515.69
7.1.240.0010.01115.82
7.1.230.0080.00615.79
7.1.220.0020.00715.78
7.1.210.0050.00715.65
7.1.200.0080.00615.71
7.1.190.0050.00815.84
7.1.180.0080.00815.76
7.1.170.0110.00315.87
7.1.160.0040.01115.74
7.1.150.0070.00515.69
7.1.140.0070.00615.84
7.1.130.0110.00615.70
7.1.120.0070.00715.71
7.1.110.0030.01115.87
7.1.100.0060.00516.64
7.1.90.0060.00815.75
7.1.80.0060.00615.81
7.1.70.0070.00716.10
7.1.60.0030.01616.99
7.1.50.0100.00616.10
7.1.40.0030.00715.86
7.1.30.0010.00915.73
7.1.20.0070.00715.77
7.1.10.0040.01315.92
7.1.00.0060.01917.93
7.0.330.0030.00615.36
7.0.320.0070.00315.47
7.0.310.0050.00815.43
7.0.300.0030.00915.36
7.0.290.0030.01215.40
7.0.280.0060.00715.49
7.0.270.0000.01315.40
7.0.260.0020.01215.24
7.0.250.0060.00615.39
7.0.240.0030.00715.47
7.0.230.0030.00815.40
7.0.220.0030.01015.53
7.0.210.0070.00615.54
7.0.200.0040.00815.84
7.0.190.0030.00915.43
7.0.180.0020.01015.40
7.0.170.0030.00715.35
7.0.160.0050.01015.41
7.0.150.0040.00815.48
7.0.140.0060.02617.69
7.0.130.0050.00715.35
7.0.120.0070.00515.59
7.0.110.0050.00515.54
7.0.100.0080.00615.44
7.0.90.0060.00615.36
7.0.80.0080.00315.16
7.0.70.0050.00715.31
7.0.60.0060.03217.52
7.0.50.0100.02917.75
7.0.40.0040.03215.65
7.0.30.0050.02315.77
7.0.20.0060.02515.67
7.0.10.0030.02915.62
7.0.00.0050.03415.70
5.6.400.0100.00314.47
5.6.390.0060.00614.75
5.6.380.0020.01014.52
5.6.370.0090.00514.33
5.6.360.0000.01214.68
5.6.350.0030.00614.57
5.6.340.0070.00714.48
5.6.330.0080.00714.44
5.6.320.0030.01014.62
5.6.310.0040.01214.31
5.6.300.0020.01314.34
5.6.290.0000.01114.61
5.6.280.0050.02916.76
5.6.270.0030.01014.41
5.6.260.0050.01014.66
5.6.250.0090.00414.54
5.6.240.0050.00514.52
5.6.230.0020.01214.41
5.6.220.0100.00514.50
5.6.210.0050.02816.51
5.6.200.0030.03616.72
5.6.190.0060.02916.62
5.6.180.0070.03216.67
5.6.170.0060.03116.64
5.6.160.0080.02916.69
5.6.150.0040.03416.61
5.6.140.0050.03016.69
5.6.130.0060.03116.63
5.6.120.0040.02916.60
5.6.110.0050.03016.59
5.6.100.0080.02616.74
5.6.90.0050.02916.72
5.6.80.0030.03716.33
5.6.70.0060.03116.38
5.6.60.0060.03216.46
5.6.50.0030.03416.44
5.6.40.0030.03016.37
5.6.30.0070.01716.49
5.6.20.0060.03416.55
5.6.10.0050.03016.45
5.6.00.0030.03416.35
5.5.380.0060.00614.29
5.5.370.0000.01114.35
5.5.360.0070.00614.38
5.5.350.0050.03216.31
5.5.340.0060.03316.51
5.5.330.0000.03216.53
5.5.320.0040.02516.59
5.5.310.0050.03516.60
5.5.300.0040.03216.71
5.5.290.0050.02516.68
5.5.280.0060.02716.61
5.5.270.0080.03116.39
5.5.260.0070.03116.61
5.5.250.0020.03516.51
5.5.240.0040.03116.36
5.5.230.0080.02616.47
5.5.220.0030.03216.44
5.5.210.0070.02116.27
5.5.200.0060.03316.30
5.5.190.0060.01716.32
5.5.180.0040.03416.24
5.5.170.0100.00514.31
5.5.160.0060.03016.29
5.5.150.0090.02716.47
5.5.140.0040.03316.31
5.5.130.0030.03116.29
5.5.120.0080.03016.35
5.5.110.0050.03116.24
5.5.100.0050.02916.15
5.5.90.0050.03016.24
5.5.80.0040.02716.29
5.5.70.0060.02816.30
5.5.60.0050.03016.27
5.5.50.0070.02816.19
5.5.40.0060.03316.15
5.5.30.0090.02916.35
5.5.20.0040.03116.17
5.5.10.0030.02916.24
5.5.00.0120.02516.30
5.4.450.0030.02713.58
5.4.440.0070.03113.76
5.4.430.0000.03013.68
5.4.420.0030.02813.70
5.4.410.0060.02613.74
5.4.400.0040.02413.65
5.4.390.0030.02913.54
5.4.380.0040.02513.52
5.4.370.0040.02613.68
5.4.360.0060.02113.60
5.4.350.0030.01913.56
5.4.340.0030.01613.58
5.4.330.0080.00610.72
5.4.320.0030.02013.61
5.4.310.0070.02713.46
5.4.300.0030.02913.60
5.4.290.0020.03213.50
5.4.280.0040.02613.45
5.4.270.0060.02613.62
5.4.260.0050.02113.38
5.4.250.0050.02813.61
5.4.240.0030.02213.63
5.4.230.0030.01913.61
5.4.220.0050.02913.57
5.4.210.0010.03213.43
5.4.200.0060.02013.54
5.4.190.0030.02713.47
5.4.180.0030.02413.60
5.4.170.0020.02913.46
5.4.160.0060.02613.48
5.4.150.0000.03413.54
5.4.140.0040.02112.70
5.4.130.0020.03012.68
5.4.120.0070.01512.72
5.4.110.0010.03112.62
5.4.100.0030.03012.69
5.4.90.0020.02812.67
5.4.80.0070.02012.68
5.4.70.0000.03112.70
5.4.60.0030.02512.71
5.4.50.0040.02712.66
5.4.40.0030.02512.60
5.4.30.0070.02512.74
5.4.20.0090.02512.74
5.4.10.0020.02812.69
5.4.00.0030.02612.49
5.3.290.0060.02311.90
5.3.280.0020.02911.88
5.3.270.0090.02311.93
5.3.260.0040.03111.92
5.3.250.0020.02811.90
5.3.240.0070.02011.86
5.3.230.0040.02811.84
5.3.220.0030.02711.90
5.3.210.0050.02711.82
5.3.200.0020.02611.94
5.3.190.0030.02311.86
5.3.180.0040.02311.82
5.3.170.0060.01711.91
5.3.160.0040.02811.98
5.3.150.0050.03011.94
5.3.140.0050.02711.83
5.3.130.0020.01811.80
5.3.120.0070.02611.90
5.3.110.0010.02711.85
5.3.100.0020.02411.71
5.3.90.0020.02511.77
5.3.80.0030.02811.69
5.3.70.0060.02111.66
5.3.60.0070.02111.77
5.3.50.0040.02811.63
5.3.40.0060.02411.61
5.3.30.0030.02811.67
5.3.20.0040.02411.58
5.3.10.0030.02811.52
5.3.00.0000.03111.52
5.2.170.0030.05311.15
5.2.160.0030.05711.04
5.2.150.0070.06311.16
5.2.140.0070.05311.13
5.2.130.0030.05311.21
5.2.120.0000.06011.09
5.2.110.0000.05711.10
5.2.100.0030.06011.18
5.2.90.0030.05711.12
5.2.80.0000.07011.20
5.2.70.0000.04011.15
5.2.60.0000.06711.09
5.2.50.0070.05711.03
5.2.40.0070.05711.04
5.2.30.0000.06010.96
5.2.20.0000.05710.93
5.2.10.0070.05710.77
5.2.00.0030.06710.78
5.1.60.0070.0539.86
5.1.50.0030.0539.84
5.1.40.0070.0439.96
5.1.30.0030.05710.25
5.1.20.0030.05710.40
5.1.10.0030.05010.15
5.1.00.0000.0579.97
5.0.50.0030.0408.99
5.0.40.0030.0408.99
5.0.30.0000.0708.99
5.0.20.0070.0308.99
5.0.10.0030.0438.99
5.0.00.0030.0608.99
4.4.90.0070.0238.99
4.4.80.0000.0378.99
4.4.70.0000.0378.99
4.4.60.0000.0308.99
4.4.50.0030.0308.99
4.4.40.0000.0508.99
4.4.30.0030.0308.99
4.4.20.0030.0338.99
4.4.10.0100.0308.99
4.4.00.0030.0478.99
4.3.110.0030.0338.99
4.3.100.0000.0338.99
4.3.90.0030.0308.99
4.3.80.0000.0478.99
4.3.70.0000.0278.99
4.3.60.0070.0308.99
4.3.50.0070.0278.99
4.3.40.0000.0578.99
4.3.30.0000.0378.99
4.3.20.0000.0378.99
4.3.10.0000.0408.99
4.3.00.0030.0308.99

preferences:
53.75 ms | 401 KiB | 5 Q