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(0, $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.0040.01118.55
8.3.50.0120.00521.92
8.3.40.0060.01218.65
8.3.30.0060.00918.67
8.3.20.0040.00418.89
8.3.10.0030.00520.61
8.3.00.0060.00323.45
8.2.180.0040.01516.63
8.2.170.0040.01122.96
8.2.160.0140.00020.44
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00419.36
8.2.110.0060.00620.99
8.2.100.0060.00617.84
8.2.90.0030.00619.26
8.2.80.0050.00317.97
8.2.70.0040.00817.50
8.2.60.0030.00618.03
8.2.50.0040.00418.10
8.2.40.0030.00618.28
8.2.30.0000.00820.01
8.2.20.0040.00417.75
8.2.10.0050.00317.74
8.2.00.0050.00317.70
8.1.280.0040.01125.92
8.1.270.0000.00723.99
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0090.00021.35
8.1.230.0040.00817.63
8.1.220.0000.00717.74
8.1.210.0030.00618.77
8.1.200.0030.00617.35
8.1.190.0040.00417.35
8.1.180.0000.00918.10
8.1.170.0040.00418.59
8.1.160.0050.00318.91
8.1.150.0040.00418.70
8.1.140.0040.00417.58
8.1.130.0000.00717.80
8.1.120.0070.00017.39
8.1.110.0030.00517.49
8.1.100.0040.00417.51
8.1.90.0050.00217.39
8.1.80.0030.00317.38
8.1.70.0000.00717.35
8.1.60.0000.00817.43
8.1.50.0000.00817.55
8.1.40.0040.00417.47
8.1.30.0090.00017.70
8.1.20.0030.00517.66
8.1.10.0040.00417.54
8.1.00.0000.00717.50
8.0.300.0040.00418.78
8.0.290.0050.00316.75
8.0.280.0000.00818.43
8.0.270.0000.00717.23
8.0.260.0040.00416.94
8.0.250.0040.00416.94
8.0.240.0040.00416.98
8.0.230.0000.00716.91
8.0.220.0000.00716.94
8.0.210.0080.00017.03
8.0.200.0030.00317.05
8.0.190.0000.00717.09
8.0.180.0000.00816.99
8.0.170.0040.00416.99
8.0.160.0030.00317.05
8.0.150.0040.00416.93
8.0.140.0040.00416.96
8.0.130.0030.00313.35
8.0.120.0080.00016.84
8.0.110.0000.00816.81
8.0.100.0000.00816.96
8.0.90.0040.00416.91
8.0.80.0040.01116.93
8.0.70.0000.00816.98
8.0.60.0050.00216.94
8.0.50.0030.00516.82
8.0.30.0100.01317.27
8.0.20.0120.00617.40
8.0.10.0040.00417.13
8.0.00.0060.01316.76
7.4.330.0000.00513.43
7.4.320.0070.00416.54
7.4.300.0000.00716.48
7.4.290.0030.00316.43
7.4.280.0030.00616.42
7.4.270.0030.00316.65
7.4.260.0000.00513.29
7.4.250.0050.00316.42
7.4.240.0030.00316.56
7.4.230.0030.00316.64
7.4.220.0090.01316.59
7.4.210.0080.00816.66
7.4.200.0030.00316.60
7.4.190.0030.00316.62
7.4.160.0120.00416.57
7.4.150.0070.01717.40
7.4.140.0130.00717.86
7.4.130.0130.00716.52
7.4.120.0100.00916.53
7.4.110.0100.00716.52
7.4.100.0140.00716.56
7.4.90.0080.01016.46
7.4.80.0120.00419.37
7.4.70.0060.01016.52
7.4.60.0130.00916.45
7.4.50.0060.00316.23
7.4.40.0100.00322.27
7.4.30.0160.00016.45
7.4.00.0080.00714.80
7.3.330.0000.00513.32
7.3.320.0030.00313.45
7.3.310.0000.00716.35
7.3.300.0030.00316.34
7.3.290.0130.00316.45
7.3.280.0090.00816.45
7.3.270.0120.00617.40
7.3.260.0100.00718.24
7.3.250.0110.00816.67
7.3.240.0150.00416.46
7.3.230.0030.01416.45
7.3.210.0030.01316.57
7.3.200.0030.01519.39
7.3.190.0090.01316.51
7.3.180.0120.00616.68
7.3.170.0090.01216.33
7.3.160.0030.01516.53
7.3.120.0060.00914.76
7.3.110.0070.01214.80
7.3.100.0090.00914.80
7.3.90.0070.01014.83
7.3.80.0050.01214.99
7.3.70.0020.01314.88
7.3.60.0050.00814.66
7.3.50.0030.01014.86
7.3.40.0040.00914.82
7.3.30.0070.00714.91
7.3.20.0100.00516.72
7.3.10.0080.00716.83
7.3.00.0060.00816.70
7.2.330.0110.01516.51
7.2.320.0090.00916.67
7.2.310.0030.01416.45
7.2.300.0070.01016.64
7.2.290.0090.00916.82
7.2.250.0070.01115.19
7.2.240.0030.01415.11
7.2.230.0080.00914.88
7.2.220.0060.00715.11
7.2.210.0070.00715.17
7.2.200.0080.00715.21
7.2.190.0090.00515.14
7.2.180.0050.01114.97
7.2.170.0070.01015.16
7.2.160.0030.01015.21
7.2.150.0070.00317.05
7.2.140.0070.01416.86
7.2.130.0050.00916.96
7.2.120.0100.00516.95
7.2.110.0080.00716.97
7.2.100.0030.01016.90
7.2.90.0020.01616.96
7.2.80.0070.00916.95
7.2.70.0030.01417.08
7.2.60.0080.00917.13
7.2.50.0040.01017.08
7.2.40.0010.01016.97
7.2.30.0040.00716.91
7.2.20.0100.00516.81
7.2.10.0050.00917.08
7.2.00.0040.01217.90
7.1.330.0080.01015.66
7.1.320.0060.00415.81
7.1.310.0050.00815.81
7.1.300.0050.00715.80
7.1.290.0000.01115.90
7.1.280.0050.00515.71
7.1.270.0040.01115.67
7.1.260.0080.00315.57
7.1.250.0050.01115.74
7.1.240.0060.00315.76
7.1.230.0120.00015.87
7.1.220.0100.00315.92
7.1.210.0070.00715.96
7.1.200.0040.00915.79
7.1.190.0030.01015.56
7.1.180.0090.00915.76
7.1.170.0030.00615.79
7.1.160.0000.01315.93
7.1.150.0090.00615.79
7.1.140.0100.00015.60
7.1.130.0090.00415.88
7.1.120.0040.01116.02
7.1.110.0000.00815.92
7.1.100.0060.00816.82
7.1.90.0100.00316.01
7.1.80.0070.00716.03
7.1.70.0000.00816.56
7.1.60.0050.01217.56
7.1.50.0070.00916.30
7.1.40.0110.00015.82
7.1.30.0030.00715.78
7.1.20.0040.00715.61
7.1.10.0070.01015.72
7.1.00.0030.02419.05
7.0.330.0040.00415.16
7.0.320.0040.00715.24
7.0.310.0040.01115.25
7.0.300.0070.00715.52
7.0.290.0030.00615.45
7.0.280.0030.01215.50
7.0.270.0070.00315.44
7.0.260.0030.01315.40
7.0.250.0080.00315.51
7.0.240.0030.01015.50
7.0.230.0030.00915.31
7.0.220.0040.00415.34
7.0.210.0030.00615.36
7.0.200.0040.00616.14
7.0.190.0030.01215.34
7.0.180.0080.00515.42
7.0.170.0000.00815.21
7.0.160.0000.01315.43
7.0.150.0030.00515.57
7.0.140.0030.04018.86
7.0.130.0000.00815.40
7.0.120.0030.01015.42
7.0.110.0030.00815.53
7.0.100.0040.00415.63
7.0.90.0070.00315.52
7.0.80.0030.01015.49
7.0.70.0030.00715.25
7.0.60.0080.04517.77
7.0.50.0080.04516.67
7.0.40.0130.03316.92
7.0.30.0090.03916.81
7.0.20.0250.01816.93
7.0.10.0080.03416.85
7.0.00.0050.04216.94
5.6.380.0000.01414.49
5.6.370.0000.00913.98
5.6.360.0060.01014.67
5.6.350.0110.00314.91
5.6.340.0030.01214.54
5.6.330.0090.00614.42
5.6.320.0060.00614.66
5.6.310.0070.00714.42
5.6.300.0040.00714.10
5.6.290.0100.00314.93
5.6.280.0070.04017.74
5.6.270.0040.00714.55
5.6.260.0000.01114.62
5.6.250.0000.01314.15
5.6.240.0060.00614.53
5.6.230.0090.00314.24
5.6.220.0090.00314.45
5.6.210.0050.04017.47
5.6.200.0080.03816.32
5.6.190.0140.03717.48
5.6.180.0130.03117.52
5.6.170.0050.04717.55
5.6.160.0130.03717.37
5.6.150.0060.02716.22
5.6.140.0030.02416.41
5.6.130.0030.03316.46
5.6.120.0070.02917.72
5.6.110.0050.04817.81
5.6.100.0080.03517.75
5.6.90.0030.04917.78
5.6.80.0100.04017.35
5.6.70.0030.01014.35
5.6.60.0060.00614.32
5.6.50.0080.00414.56
5.6.40.0080.00814.73
5.6.30.0110.00414.62
5.6.20.0040.01114.29
5.6.10.0060.00914.33
5.6.00.0060.00314.50
5.5.380.0000.00811.30
5.5.370.0070.00011.12
5.5.360.0040.00411.62
5.5.350.1820.02015.99
5.5.340.0020.02514.63
5.5.330.0080.04115.94
5.5.320.0170.03715.70
5.5.310.0180.03715.84
5.5.300.0080.04014.67
5.5.290.0040.04614.67
5.5.280.0200.03916.10
5.5.270.0100.03716.18
5.5.260.0050.04616.10
5.5.250.0060.04215.88
5.5.240.0070.03515.67
5.5.230.0040.00411.41
5.5.220.0100.00011.20
5.5.210.0030.00411.00
5.5.200.0030.00711.29
5.5.190.0000.00911.30
5.5.180.0000.00711.47
5.5.170.0100.00311.46
5.5.160.0000.01211.31
5.5.150.0080.00011.42
5.5.140.0000.01011.44
5.5.130.0050.00811.18
5.5.120.0000.01111.39
5.5.110.0040.00411.14
5.5.100.0040.00511.28
5.5.90.0060.00011.43
5.5.80.0060.00011.37
5.5.70.0030.00911.00
5.5.60.0090.00311.00
5.5.50.0050.00211.07
5.5.40.0060.00011.31
5.5.30.0080.00311.44
5.5.20.0000.00711.36
5.5.10.0030.00311.14
5.5.00.0040.00811.41
5.4.450.0170.02315.24
5.4.440.0170.01915.14
5.4.430.0100.02415.08
5.4.420.0080.03215.28
5.4.410.0170.01815.10
5.4.400.0110.03015.04
5.4.390.0120.02215.12
5.4.380.0110.02415.12
5.4.370.0150.03815.03
5.4.360.0110.02314.99
5.4.350.0170.02515.07
5.4.340.0150.02815.08
5.4.330.0000.00811.00
5.4.320.0100.04115.08
5.4.310.0110.03315.08
5.4.300.0110.04015.07
5.4.290.0170.03815.03
5.4.280.0180.03915.11
5.4.270.0130.03514.99
5.4.260.0160.02315.02
5.4.250.0130.03815.03
5.4.240.0170.02515.18
5.4.230.0120.02215.11
5.4.220.0150.02714.99
5.4.210.0150.04215.10
5.4.200.0130.02815.09
5.4.190.0080.04015.11
5.4.180.0110.03115.07
5.4.170.0130.04515.12
5.4.160.0120.02715.06
5.4.150.0130.02515.04
5.4.140.0100.02713.78
5.4.130.0160.03613.70
5.4.120.0100.02313.70
5.4.110.0190.03313.78
5.4.100.0190.02213.80
5.4.90.0100.02513.79
5.4.80.0140.03913.80
5.4.70.0080.02313.78
5.4.60.0100.02113.69
5.4.50.0150.02013.74
5.4.40.0130.03613.76
5.4.30.0160.02313.77
5.4.20.0150.02813.58
5.4.10.0130.02513.66
5.4.00.0150.03413.43
5.3.290.0130.01812.79
5.3.280.0130.03012.84
5.3.270.0150.02512.80
5.3.260.0120.02712.81
5.3.250.0160.03712.79
5.3.240.0080.02412.79
5.3.230.0110.02512.77
5.3.220.0150.03512.74
5.3.210.0140.03212.85
5.3.200.0080.02412.77
5.3.190.0130.01912.83
5.3.180.0120.03312.80
5.3.170.0120.02012.74
5.3.160.0080.02112.91
5.3.150.0100.02112.79
5.3.140.0120.03812.81
5.3.130.0100.02712.77
5.3.120.0080.02312.89
5.3.110.0210.03212.78
5.3.100.0110.02612.52
5.3.90.0120.02312.59
5.3.80.0120.02012.48
5.3.70.0120.03412.46
5.3.60.0130.03812.51
5.3.50.0110.01812.44
5.3.40.0080.02112.44
5.3.30.0120.01712.50
5.3.20.0100.03512.31
5.3.10.0110.02312.45
5.3.00.0080.03312.37
5.2.170.0110.01511.97
5.2.160.0120.02811.97
5.2.150.0080.03111.97
5.2.140.0070.02211.97
5.2.130.0130.02611.97
5.2.120.0050.02511.97
5.2.110.0040.01711.97
5.2.100.0070.03211.97
5.2.90.0120.01211.97
5.2.80.0070.01911.97
5.2.70.0100.02611.97
5.2.60.0100.02211.97
5.2.50.0120.02511.97
5.2.40.0130.03211.97
5.2.30.0160.02511.97
5.2.20.0060.02311.97
5.2.10.0070.03711.97
5.2.00.0100.02611.97
5.1.60.0090.03011.97
5.1.50.0100.01811.97
5.1.40.0090.01511.97
5.1.30.0130.02511.97
5.1.20.0070.02711.97
5.1.10.0080.03111.97
5.1.00.0120.02911.97
5.0.50.0090.01311.97
5.0.40.0030.02511.97
5.0.30.0050.02211.97
5.0.20.0070.02511.97
5.0.10.0070.01311.97
5.0.00.0050.03311.97
4.4.90.0080.00911.97
4.4.80.0050.01911.97
4.4.70.0070.01311.97
4.4.60.0050.01811.97
4.4.50.0030.01611.97
4.4.40.0030.02911.97
4.4.30.0090.01611.97
4.4.20.0030.01711.97
4.4.10.0080.01811.97
4.4.00.0020.02511.97
4.3.110.0050.01511.97
4.3.100.0100.01211.97
4.3.90.0100.01211.97
4.3.80.0050.01811.97
4.3.70.0030.02111.97
4.3.60.0030.01411.97
4.3.50.0070.01011.97
4.3.40.0070.02211.97
4.3.30.0050.01011.97
4.3.20.0000.01211.97
4.3.10.0030.00711.97
4.3.00.0030.00811.97

preferences:
45.12 ms | 400 KiB | 5 Q