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 ($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 = [ function($it) { foreach ($it as $val) { yield chr($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.0040.01116.63
8.3.50.0060.00921.90
8.3.40.0120.00318.70
8.3.30.0140.00019.23
8.3.20.0040.00420.41
8.3.10.0040.00423.56
8.3.00.0000.00820.95
8.2.180.0090.00616.38
8.2.170.0160.00022.96
8.2.160.0070.00720.43
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0060.00319.31
8.2.110.0040.00421.90
8.2.100.0040.00820.07
8.2.90.0000.00819.18
8.2.80.0080.00017.97
8.2.70.0030.00617.72
8.2.60.0080.00018.03
8.2.50.0030.00618.07
8.2.40.0000.00820.01
8.2.30.0000.00718.36
8.2.20.0060.00317.73
8.2.10.0040.00418.20
8.2.00.0040.00417.82
8.1.280.0130.00325.92
8.1.270.0120.00622.14
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0070.00323.66
8.1.230.0000.01119.14
8.1.220.0040.00417.79
8.1.210.0030.00518.77
8.1.200.0030.00617.23
8.1.190.0080.00017.35
8.1.180.0000.00818.10
8.1.170.0070.00318.59
8.1.160.0000.00722.04
8.1.150.0000.00818.54
8.1.140.0040.00417.46
8.1.130.0030.00617.76
8.1.120.0070.00017.42
8.1.110.0110.00017.41
8.1.100.0040.00417.44
8.1.90.0050.00217.43
8.1.80.0000.00717.54
8.1.70.0050.00217.44
8.1.60.0080.00417.60
8.1.50.0040.00417.45
8.1.40.0000.00817.43
8.1.30.0080.00417.59
8.1.20.0090.00017.73
8.1.10.0040.00417.52
8.1.00.0080.00017.55
8.0.300.0070.00018.77
8.0.290.0040.00417.18
8.0.280.0030.00318.47
8.0.270.0030.00617.23
8.0.260.0060.00017.24
8.0.250.0070.00017.05
8.0.240.0040.00417.04
8.0.230.0040.00416.93
8.0.220.0040.00417.01
8.0.210.0030.00316.82
8.0.200.0050.00317.10
8.0.190.0070.00016.96
8.0.180.0040.00416.94
8.0.170.0070.00316.92
8.0.160.0000.00716.88
8.0.150.0000.00816.95
8.0.140.0030.00616.84
8.0.130.0060.00013.41
8.0.120.0040.00416.88
8.0.110.0000.00816.98
8.0.100.0070.00316.92
8.0.90.0000.00716.82
8.0.80.0090.00916.93
8.0.70.0000.00816.81
8.0.60.0040.00416.94
8.0.50.0070.00016.85
8.0.30.0120.01017.08
8.0.20.0120.00917.40
8.0.10.0050.00217.04
8.0.00.0130.00516.90
7.4.330.0000.00515.05
7.4.320.0030.00316.55
7.4.300.0040.00416.62
7.4.290.0030.00316.62
7.4.280.0050.00216.52
7.4.270.0030.00316.55
7.4.260.0070.00016.52
7.4.250.0000.00716.55
7.4.240.0040.00416.62
7.4.230.0030.00316.61
7.4.220.0130.00716.66
7.4.210.0100.00616.57
7.4.200.0000.00716.66
7.4.190.0000.00716.39
7.4.160.0070.01416.54
7.4.150.0140.00317.40
7.4.140.0120.00617.86
7.4.130.0030.01416.46
7.4.120.0130.01016.56
7.4.110.0100.01416.55
7.4.100.0040.01516.63
7.4.90.0100.01016.52
7.4.80.0170.00919.39
7.4.70.0090.00916.68
7.4.60.0140.00716.71
7.4.50.0030.00616.31
7.4.40.0150.00716.67
7.4.30.0130.00316.43
7.4.00.0070.00715.09
7.3.330.0030.00313.46
7.3.320.0050.00013.47
7.3.310.0040.00416.49
7.3.300.0070.00016.32
7.3.290.0060.01016.39
7.3.280.0120.00716.43
7.3.270.0150.00917.40
7.3.260.0110.00616.47
7.3.250.0100.00716.57
7.3.240.0100.01016.59
7.3.230.0090.00816.39
7.3.210.0140.00416.60
7.3.200.0140.00719.39
7.3.190.0160.01016.64
7.3.180.0060.01016.64
7.3.170.0130.00316.65
7.3.160.0060.01016.65
7.3.120.0080.00914.89
7.3.110.0070.00715.01
7.3.100.0080.01214.95
7.3.90.0040.01114.64
7.3.80.0070.01014.84
7.3.70.0000.01715.00
7.3.60.0090.00014.82
7.3.50.0040.01114.98
7.3.40.0070.00414.70
7.3.30.0040.01114.90
7.3.20.0110.00416.51
7.3.10.0000.01316.51
7.3.00.0060.00616.54
7.2.330.0060.01216.82
7.2.320.0120.01216.50
7.2.310.0060.01116.48
7.2.300.0070.01316.69
7.2.290.0130.00316.82
7.2.250.0070.01315.00
7.2.240.0070.01515.30
7.2.230.0080.00814.89
7.2.220.0040.01114.73
7.2.210.0030.01415.32
7.2.200.0100.00714.97
7.2.190.0040.01115.22
7.2.180.0000.01715.16
7.2.170.0100.00715.15
7.2.160.0030.01315.27
7.2.150.0030.01316.85
7.2.140.0110.00416.82
7.2.130.0080.00516.78
7.2.120.0020.01116.98
7.2.110.0060.00616.92
7.2.100.0060.00616.80
7.2.90.0000.01416.96
7.2.80.0080.00516.86
7.2.70.0040.00917.04
7.2.60.0070.00616.83
7.2.50.0070.00616.99
7.2.40.0020.01116.90
7.2.30.0070.00517.03
7.2.20.0080.00617.00
7.2.10.0050.00617.04
7.2.00.0040.01017.61
7.1.330.0090.00915.70
7.1.320.0100.00715.86
7.1.310.0030.01315.80
7.1.300.0000.01415.85
7.1.290.0000.01315.73
7.1.280.0070.00715.89
7.1.270.0080.00415.89
7.1.260.0070.01115.53
7.1.250.0060.00615.94
7.1.240.0070.00715.88
7.1.230.0080.00415.62
7.1.220.0060.00615.86
7.1.210.0030.00615.83
7.1.200.0070.00715.76
7.1.190.0060.00315.63
7.1.180.0030.01015.79
7.1.170.0120.00016.04
7.1.160.0030.01415.47
7.1.150.0070.00715.82
7.1.140.0000.01115.73
7.1.130.0040.00715.96
7.1.120.0030.01015.61
7.1.110.0030.01016.04
7.1.100.0060.00717.00
7.1.90.0100.00716.03
7.1.80.0070.00715.93
7.1.70.0060.00616.29
7.1.60.0050.01017.53
7.1.50.0100.01016.52
7.1.40.0060.00615.82
7.1.30.0040.01215.81
7.1.20.0060.00915.87
7.1.10.0060.00915.75
7.1.00.0070.04119.06
7.0.330.0000.01215.49
7.0.320.0070.00415.33
7.0.310.0040.00415.41
7.0.300.0030.00615.46
7.0.290.0110.00415.50
7.0.280.0040.00915.36
7.0.270.0040.01115.46
7.0.260.0070.00315.36
7.0.250.0090.00315.40
7.0.240.0120.00315.32
7.0.230.0140.00315.38
7.0.220.0120.00015.57
7.0.210.0080.00415.52
7.0.200.0020.00916.02
7.0.190.0000.01715.14
7.0.180.0030.01315.60
7.0.170.0040.01215.46
7.0.160.0070.00315.46
7.0.150.0040.00715.32
7.0.140.0060.03618.80
7.0.130.0030.00815.38
7.0.120.0030.01015.36
7.0.110.0060.00615.61
7.0.100.0090.00315.49
7.0.90.0110.00415.63
7.0.80.0080.00015.24
7.0.70.0000.01415.43
7.0.60.0130.04517.57
7.0.50.0050.04316.69
7.0.40.0050.02815.68
7.0.30.0110.03015.73
7.0.20.0030.04815.50
7.0.10.0050.04515.67
7.0.00.0040.02315.50
5.6.400.0070.01114.63
5.6.390.0060.00914.22
5.6.380.0030.01014.47
5.6.370.0070.00314.52
5.6.360.0030.01014.80
5.6.350.0030.01414.14
5.6.340.0030.00614.52
5.6.330.0030.01014.70
5.6.320.0110.00314.84
5.6.310.0140.00014.56
5.6.300.0040.00814.64
5.6.290.0070.01014.41
5.6.280.0000.04517.74
5.6.270.0040.00414.55
5.6.260.0030.00614.57
5.6.250.0080.00614.77
5.6.240.0070.00714.32
5.6.230.0070.00314.41
5.6.220.0070.00714.47
5.6.210.0120.01917.41
5.6.200.0040.03916.42
5.6.190.0030.02816.41
5.6.180.0030.02616.23
5.6.170.0030.04516.40
5.6.160.0070.02816.47
5.6.150.0030.03816.29
5.6.140.0030.02516.28
5.6.130.0020.02916.35
5.6.120.0110.02216.37
5.6.110.0150.03816.34
5.6.100.0110.03016.33
5.6.90.0120.01816.23
5.6.80.0000.02815.98
5.6.70.0000.04015.92
5.6.60.0070.02216.04
5.6.50.0050.02316.13
5.6.40.0070.03515.96
5.6.30.0040.03815.95
5.6.20.0070.02216.08
5.6.10.0140.01315.86
5.6.00.0000.02616.00
5.5.380.0060.00614.39
5.5.370.0030.00714.59
5.5.360.0090.00614.51
5.5.350.1930.02317.39
5.5.340.0030.02716.31
5.5.330.0030.04316.04
5.5.320.0050.02516.15
5.5.310.0080.03816.12
5.5.300.0110.02016.20
5.5.290.0090.02216.18
5.5.280.0070.03116.30
5.5.270.0090.04416.35
5.5.260.0090.02216.05
5.5.250.0050.02416.17
5.5.240.0040.04115.92
5.5.230.0000.02815.98
5.5.220.0020.03215.94
5.5.210.0060.02015.91
5.5.200.0070.03815.86
5.5.190.0030.02515.89
5.5.180.0050.02215.97
5.5.170.0100.00314.56
5.5.160.0030.02415.87
5.5.150.0020.02216.00
5.5.140.0050.02315.99
5.5.130.0100.01715.95
5.5.120.0030.02215.85
5.5.110.0030.02415.84
5.5.100.0030.02315.83
5.5.90.0030.02315.84
5.5.80.0020.02515.80
5.5.70.0020.02515.86
5.5.60.0030.02515.81
5.5.50.0070.02015.79
5.5.40.0070.02015.71
5.5.30.0080.02015.56
5.5.20.0030.02315.86
5.5.10.0050.02115.74
5.5.00.0050.02315.81
5.4.450.0030.02515.58
5.4.440.0010.02615.52
5.4.430.0070.04215.57
5.4.420.0060.02815.58
5.4.410.0050.02315.55
5.4.400.0050.02015.46
5.4.390.0020.03515.45
5.4.380.0070.03815.39
5.4.370.0020.04215.43
5.4.360.0010.02315.40
5.4.350.0070.01815.47
5.4.340.0050.02215.35
5.4.330.0000.00811.81
5.4.320.0020.02315.43
5.4.310.0030.02015.42
5.4.300.0080.01815.47
5.4.290.0100.02215.43
5.4.280.0050.02215.44
5.4.270.0070.02015.43
5.4.260.0050.02015.42
5.4.250.0040.02115.45
5.4.240.0030.02015.43
5.4.230.0060.02015.43
5.4.220.0020.02315.41
5.4.210.0080.01815.40
5.4.200.0100.01515.39
5.4.190.0070.02015.45
5.4.180.0080.01815.53
5.4.170.0040.02015.45
5.4.160.0020.02515.38
5.4.150.0020.02315.53
5.4.140.0050.01814.11
5.4.130.0080.01314.15
5.4.120.0000.02414.09
5.4.110.0100.01814.15
5.4.100.0050.01814.09
5.4.90.0060.03014.11
5.4.80.0030.03414.16
5.4.70.0130.02114.15
5.4.60.0000.02414.08
5.4.50.0090.03614.07
5.4.40.0030.02214.17
5.4.30.0080.03814.09
5.4.20.0030.01914.11
5.4.10.0080.04014.11
5.4.00.0000.02413.82
5.3.290.0020.02213.35
5.3.280.0050.02013.22
5.3.270.0050.01913.22
5.3.260.0030.02213.21
5.3.250.0040.02013.22
5.3.240.0030.02113.22
5.3.230.0050.02213.23
5.3.220.0050.01813.19
5.3.210.0020.02313.30
5.3.200.0030.02613.30
5.3.190.0030.02313.22
5.3.180.0050.02113.20
5.3.170.0060.03813.12
5.3.160.0020.02913.21
5.3.150.0060.03313.22
5.3.140.0030.04313.20
5.3.130.0080.02213.29
5.3.120.0020.02413.18
5.3.110.0090.03713.29
5.3.100.0070.01712.97
5.3.90.0040.03812.92
5.3.80.0070.03712.94
5.3.70.0060.04012.93
5.3.60.0030.04112.93
5.3.50.0020.03212.89
5.3.40.0050.03312.89
5.3.30.0060.03012.92
5.3.20.0070.02312.70
5.3.10.0000.02912.76
5.3.00.0050.03112.74
5.2.170.0100.02311.21
5.2.160.0100.05311.20
5.2.150.0070.04311.20
5.2.140.0000.03011.15
5.2.130.0170.01711.12
5.2.120.0100.05311.18
5.2.110.0070.05311.00
5.2.100.0070.06011.16
5.2.90.0030.05311.15
5.2.80.0070.04711.13
5.2.70.0030.03311.09
5.2.60.0000.07011.13
5.2.50.0030.05310.92
5.2.40.0030.06010.98
5.2.30.0070.06011.07
5.2.20.0100.06011.03
5.2.10.0170.05010.88
5.2.00.0030.05010.80
5.1.60.0030.0579.92
5.1.50.0070.05010.07
5.1.40.0030.0509.90
5.1.30.0100.03710.40
5.1.20.0000.06310.41
5.1.10.0030.06010.08
5.1.00.0070.05310.12
5.0.50.0100.0408.48
5.0.40.0030.0438.42
5.0.30.0130.0578.17
5.0.20.0070.0438.31
5.0.10.0000.0508.10
5.0.00.0030.0678.23
4.4.90.0070.0207.83
4.4.80.0100.0277.83
4.4.70.0100.0307.83
4.4.60.0030.0337.83
4.4.50.0000.0337.83
4.4.40.0030.0437.83
4.4.30.0070.0237.83
4.4.20.0000.0377.83
4.4.10.0000.0337.83
4.4.00.0030.0437.83
4.3.110.0000.0307.83
4.3.100.0000.0337.83
4.3.90.0070.0237.83
4.3.80.0070.0477.83
4.3.70.0070.0277.83
4.3.60.0100.0277.83
4.3.50.0000.0277.83
4.3.40.0030.0277.83
4.3.30.0000.0307.83
4.3.20.0000.0377.83
4.3.10.0030.0337.83
4.3.00.0000.0377.83

preferences:
45.51 ms | 401 KiB | 5 Q