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 = [ function($it) { foreach ($it as $val) { yield ord($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.00018.18
8.3.50.0140.00521.93
8.3.40.0080.00818.84
8.3.30.0130.00618.84
8.3.20.0000.00818.85
8.3.10.0000.00821.07
8.3.00.0040.00423.66
8.2.180.0100.01018.54
8.2.170.0150.00022.96
8.2.160.0120.00320.52
8.2.150.0000.00825.66
8.2.140.0040.00424.66
8.2.130.0030.00626.16
8.2.120.0040.00420.99
8.2.110.0100.00019.29
8.2.100.0120.00017.84
8.2.90.0050.00319.43
8.2.80.0000.00917.97
8.2.70.0040.00417.50
8.2.60.0040.00417.91
8.2.50.0060.00318.07
8.2.40.0050.00317.92
8.2.30.0000.00821.28
8.2.20.0040.00417.68
8.2.10.0040.00417.75
8.2.00.0000.00817.80
8.1.280.0070.01625.92
8.1.270.0080.00022.25
8.1.260.0160.00326.35
8.1.250.0080.00028.09
8.1.240.0210.00322.55
8.1.230.0060.00620.79
8.1.220.0000.00818.77
8.1.210.0090.00018.97
8.1.200.0030.00617.38
8.1.190.0030.00517.54
8.1.180.0000.00818.10
8.1.170.0040.00418.50
8.1.160.0040.00418.88
8.1.150.0000.00818.61
8.1.140.0000.00817.40
8.1.130.0050.00517.89
8.1.120.0080.00017.40
8.1.110.0030.00517.41
8.1.100.0040.00417.51
8.1.90.0000.00817.45
8.1.80.0040.00417.51
8.1.70.0000.00717.45
8.1.60.0060.00317.63
8.1.50.0030.00517.40
8.1.40.0040.00417.54
8.1.30.0080.00017.69
8.1.20.0030.00617.68
8.1.10.0050.00317.53
8.1.00.0040.00417.49
8.0.300.0070.00019.89
8.0.290.0050.00217.18
8.0.280.0000.00718.46
8.0.270.0000.00717.34
8.0.260.0000.00716.86
8.0.250.0050.00316.96
8.0.240.0040.00417.09
8.0.230.0020.00516.96
8.0.220.0060.00317.02
8.0.210.0070.00016.82
8.0.200.0040.00417.03
8.0.190.0000.00817.04
8.0.180.0040.00416.89
8.0.170.0030.00516.93
8.0.160.0030.00517.05
8.0.150.0040.00416.87
8.0.140.0040.00416.95
8.0.130.0030.00313.47
8.0.120.0030.00516.83
8.0.110.0040.00416.93
8.0.100.0030.00616.94
8.0.90.0060.00316.94
8.0.80.0040.01417.00
8.0.70.0050.00316.88
8.0.60.0030.00617.02
8.0.50.0060.00317.00
8.0.30.0160.00617.00
8.0.20.0140.01017.40
8.0.10.0040.00417.10
8.0.00.0160.00516.80
7.4.330.0000.00514.77
7.4.320.0040.00416.63
7.4.300.0030.00516.54
7.4.290.0050.00316.61
7.4.280.0030.00516.44
7.4.270.0040.00416.52
7.4.260.0060.00013.33
7.4.250.0040.00416.42
7.4.240.0040.00416.62
7.4.230.0000.00716.62
7.4.220.0070.01416.48
7.4.210.0080.00916.59
7.4.200.0000.00716.46
7.4.190.0040.00416.69
7.4.160.0100.00716.64
7.4.150.0130.00717.40
7.4.140.0110.01117.86
7.4.130.0070.01416.60
7.4.120.0140.00716.60
7.4.110.0090.01216.64
7.4.100.0100.01016.52
7.4.90.0100.00916.64
7.4.80.0120.00819.39
7.4.70.0180.00616.43
7.4.60.0210.00016.54
7.4.50.0030.00616.51
7.4.40.0030.01322.52
7.4.30.0060.01416.35
7.4.10.0060.01314.97
7.4.00.0080.00914.93
7.3.330.0000.00513.42
7.3.320.0000.00513.40
7.3.310.0030.00316.27
7.3.300.0070.00016.36
7.3.290.0040.01116.39
7.3.280.0100.00916.40
7.3.270.0090.00917.40
7.3.260.0130.00918.24
7.3.250.0140.01016.55
7.3.240.0100.01516.73
7.3.230.0140.00716.58
7.3.210.0080.01216.30
7.3.200.0100.00919.39
7.3.190.0110.01416.36
7.3.180.0080.01516.61
7.3.170.0110.00716.48
7.3.160.0030.01416.49
7.3.130.0060.01014.84
7.3.120.0070.01014.93
7.3.110.0080.01015.00
7.3.100.0100.00314.94
7.3.90.0060.00814.76
7.3.80.0100.00714.87
7.3.70.0070.00814.96
7.3.60.0030.01014.96
7.3.50.0050.00714.85
7.3.40.0090.00614.80
7.3.30.0070.00814.70
7.3.20.0050.00916.76
7.3.10.0070.00716.68
7.3.00.0060.00616.66
7.2.330.0090.01016.45
7.2.320.0210.00016.88
7.2.310.0090.01016.64
7.2.300.0090.00916.80
7.2.290.0100.01016.59
7.2.260.0030.01915.05
7.2.250.0050.01415.06
7.2.240.0050.01115.17
7.2.230.0080.00515.10
7.2.220.0030.01215.25
7.2.210.0070.00715.18
7.2.200.0020.01115.19
7.2.190.0030.01215.13
7.2.180.0050.01015.02
7.2.170.0060.01114.87
7.2.160.0030.01214.89
7.2.150.0080.00417.05
7.2.140.0030.00616.69
7.2.130.0080.00916.82
7.2.120.0060.00816.89
7.2.110.0060.01116.79
7.2.100.0080.01016.91
7.2.90.0060.01017.05
7.2.80.0080.00716.98
7.2.70.0050.01116.97
7.2.60.0060.00816.92
7.2.50.0050.00717.01
7.2.40.0030.01417.05
7.2.30.0110.00616.96
7.2.20.0060.00617.09
7.2.10.0040.01116.97
7.2.00.0020.01217.44
7.1.330.0060.00915.77
7.1.320.0080.00315.96
7.1.310.0040.00915.91
7.1.300.0050.00915.61
7.1.290.0050.00615.78
7.1.280.0060.00815.96
7.1.270.0070.00815.78
7.1.260.0030.00915.72
7.1.250.0020.00915.80
7.1.240.0050.01115.85
7.1.230.0110.00515.82
7.1.220.0050.01015.97
7.1.210.0070.01015.93
7.1.200.0050.00915.72
7.1.190.0090.00715.68
7.1.180.0070.00915.83
7.1.170.0030.01215.91
7.1.160.0060.00515.85
7.1.150.0160.00215.71
7.1.140.0060.00915.74
7.1.130.0060.00915.79
7.1.120.0110.00315.86
7.1.110.0070.00815.87
7.1.100.0030.01116.50
7.1.90.0100.00715.87
7.1.80.0100.00515.83
7.1.70.0090.00416.22
7.1.60.0060.01317.12
7.1.50.0120.01116.05
7.1.40.0090.00715.72
7.1.30.0020.01315.54
7.1.20.0050.00715.69
7.1.10.0070.00915.90
7.1.00.0020.01718.12
7.0.330.0040.00515.20
7.0.320.0030.01015.27
7.0.310.0030.00715.33
7.0.300.0050.01015.52
7.0.290.0050.00815.29
7.0.280.0080.00715.30
7.0.270.0060.00715.25
7.0.260.0020.01115.28
7.0.250.0040.00915.48
7.0.240.0060.00815.38
7.0.230.0050.01315.53
7.0.220.0050.00815.49
7.0.210.0030.01015.19
7.0.200.0040.00815.75
7.0.190.0070.00915.52
7.0.180.0050.00715.40
7.0.170.0060.00615.55
7.0.160.0070.00615.29
7.0.150.0090.00515.19
7.0.140.0060.02917.60
7.0.130.0080.00515.36
7.0.120.0100.00315.43
7.0.110.0040.01315.49
7.0.100.0060.00615.36
7.0.90.0070.00615.46
7.0.80.0050.01015.45
7.0.70.0060.03417.43
7.0.60.0070.03417.44
7.0.50.0050.03017.62
7.0.40.0040.02915.67
7.0.30.0080.02315.66
7.0.20.0080.02515.63
7.0.10.0020.02215.71
7.0.00.0040.03515.68
5.6.400.0070.01014.42
5.6.390.0090.00014.52
5.6.380.0050.01014.10
5.6.370.0100.00514.51
5.6.360.0060.01014.36
5.6.350.0050.00714.31
5.6.340.0060.00814.24
5.6.330.0090.00814.29
5.6.320.0030.01014.37
5.6.310.0060.01114.35
5.6.300.0030.01414.13
5.6.290.0020.01214.39
5.6.280.0070.02616.39
5.6.270.0020.01114.39
5.6.260.0070.00814.44
5.6.250.0050.01014.34
5.6.240.0080.00314.25
5.6.230.0050.00814.30
5.6.220.0090.03016.40
5.6.210.0080.01816.35
5.6.200.0100.02716.47
5.6.190.0110.01816.53
5.6.180.0080.02316.45
5.6.170.0020.03616.49
5.6.160.0080.03216.57
5.6.150.0060.03216.63
5.6.140.0100.03216.57
5.6.130.0080.03216.70
5.6.120.0060.03516.60
5.6.110.0020.03316.40
5.6.100.0060.03516.51
5.6.90.0070.02516.52
5.6.80.0070.03116.26
5.6.70.0040.03516.30
5.6.60.0020.02616.16
5.6.50.0070.03216.26
5.6.40.0090.02716.37
5.6.30.0040.03516.11
5.6.20.0070.03216.32
5.6.10.0080.02816.25
5.6.00.0060.02616.29
5.5.380.0050.00512.62
5.5.370.0090.00212.82
5.5.360.0080.03015.21
5.5.350.0060.02315.27
5.5.340.0030.03315.54
5.5.330.0070.03115.32
5.5.320.0020.02115.33
5.5.310.0060.02015.37
5.5.300.0070.03415.41
5.5.290.0030.03415.50
5.5.280.0030.02015.21
5.5.270.0040.03315.41
5.5.260.0050.03315.44
5.5.250.0060.03215.20
5.5.240.0030.03115.10
5.5.230.0030.03015.13
5.5.220.0050.02814.94
5.5.210.0050.03115.24
5.5.200.0030.03014.99
5.5.190.0030.03315.20
5.5.180.0030.03015.21
5.5.170.0030.00812.36
5.5.160.0050.02115.16
5.5.150.0090.03015.11
5.5.140.0060.03115.17
5.5.130.0060.03115.03
5.5.120.0040.03415.01
5.5.110.0070.02115.09
5.5.100.0060.01715.07
5.5.90.0040.02415.18
5.5.80.0070.02215.11
5.5.70.0040.02215.06
5.5.60.0030.03115.04
5.5.50.0090.03015.02
5.5.40.0040.03315.01
5.5.30.0080.03114.95
5.5.20.0060.03114.98
5.5.10.0090.03114.90
5.5.00.0060.03215.04
5.4.450.0070.02014.22
5.4.440.0090.02714.21
5.4.430.0040.02914.27
5.4.420.0020.03114.20
5.4.410.0040.02914.19
5.4.400.0050.02513.99
5.4.390.0040.02614.12
5.4.380.0100.02414.05
5.4.370.0060.03114.07
5.4.360.0030.02214.04
5.4.350.0030.03214.12
5.4.340.0040.02814.13
5.4.330.0070.00511.56
5.4.320.0040.02614.06
5.4.310.0100.01914.08
5.4.300.0020.03314.22
5.4.290.0090.02614.17
5.4.280.0100.02714.05
5.4.270.0020.03014.12
5.4.260.0040.02114.13
5.4.250.0020.02714.11
5.4.240.0050.01714.07
5.4.230.0100.02314.04
5.4.220.0040.02514.15
5.4.210.0020.03114.19
5.4.200.0070.02614.07
5.4.190.0060.02314.07
5.4.180.0020.03014.07
5.4.170.0070.03014.08
5.4.160.0040.02614.01
5.4.150.0040.03013.90
5.4.140.0040.03113.27
5.4.130.0070.02213.19
5.4.120.0040.02713.20
5.4.110.0030.03013.13
5.4.100.0030.02313.29
5.4.90.0060.02713.19
5.4.80.0070.02713.18
5.4.70.0080.02313.23
5.4.60.0050.02713.25
5.4.50.0030.02513.26
5.4.40.0050.02913.16
5.4.30.0050.02013.32
5.4.20.0070.01513.26
5.4.10.0020.02413.23
5.4.00.0080.02813.10
5.3.290.0030.02912.52
5.3.280.0030.03112.45
5.3.270.0060.01812.56
5.3.260.0030.02912.56
5.3.250.0050.01812.49
5.3.240.0020.02612.49
5.3.230.0050.02112.48
5.3.220.0060.02812.43
5.3.210.0070.02812.42
5.3.200.0060.02612.43
5.3.190.0020.02112.48
5.3.180.0050.02112.59
5.3.170.0090.02412.58
5.3.160.0060.02112.60
5.3.150.0050.03012.54
5.3.140.0060.02812.44
5.3.130.0060.02912.54
5.3.120.0020.02812.57
5.3.110.0040.02512.54
5.3.100.0020.03112.29
5.3.90.0040.02512.29
5.3.80.0010.02412.40
5.3.70.0030.03012.27
5.3.60.0030.02712.35
5.3.50.0040.02912.33
5.3.40.0080.02412.25
5.3.30.0010.02912.29
5.3.20.0040.02812.19
5.3.10.0050.02412.14
5.3.00.0060.01512.15
5.2.170.0060.03310.89
5.2.160.0030.03110.89
5.2.150.0040.03310.88
5.2.140.0060.03310.88
5.2.130.0020.02810.85
5.2.120.0050.03310.71
5.2.110.0030.03510.85
5.2.100.0020.03210.83
5.2.90.0050.02310.83
5.2.80.0000.02310.73
5.2.70.0020.02710.82
5.2.60.0050.03310.80
5.2.50.0020.02910.84
5.2.40.0060.02510.85
5.2.30.0030.03310.79
5.2.20.0080.02610.69
5.2.10.0020.03410.65
5.2.00.0030.03010.70
5.1.60.0020.02210.38
5.1.50.0030.03110.37
5.1.40.0020.02610.41
5.1.30.0050.02910.48
5.1.20.0050.02710.40
5.1.10.0000.03110.39
5.1.00.0000.03010.24
5.0.50.0000.02410.24
5.0.40.0000.01510.24
5.0.30.0000.03710.24
5.0.20.0080.01110.24
5.0.10.0020.02410.24
5.0.00.0000.03510.24
4.4.90.0000.01810.24
4.4.80.0030.01410.24
4.4.70.0020.02010.24
4.4.60.0020.01710.24
4.4.50.0030.01810.24
4.4.40.0020.02710.24
4.4.30.0020.02210.24
4.4.20.0050.01810.24
4.4.10.0060.01810.24
4.4.00.0030.02310.24
4.3.110.0020.01210.24
4.3.100.0000.01810.24
4.3.90.0020.01810.24
4.3.80.0020.02510.24
4.3.70.0000.01710.24
4.3.60.0040.01910.24
4.3.50.0020.02010.24
4.3.40.0030.02710.24
4.3.30.0030.01910.24
4.3.20.0020.01610.24
4.3.10.0000.02010.24
4.3.00.0020.02010.24

preferences:
54.78 ms | 400 KiB | 5 Q