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 = [ ["iterator_chunk", 32], function($it) { foreach ($it as $val) { yield chr($val); } }, ]; $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.0110.00416.75
8.3.50.0090.00921.86
8.3.40.0070.01018.88
8.3.30.0040.01119.22
8.3.20.0040.00420.29
8.3.10.0000.00923.66
8.3.00.0030.00719.14
8.2.180.0170.00716.63
8.2.170.0040.01522.96
8.2.160.0070.00720.39
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0070.00026.16
8.2.120.0060.00320.92
8.2.110.0060.00320.54
8.2.100.0030.00917.72
8.2.90.0000.00919.30
8.2.80.0060.00317.97
8.2.70.0030.00617.25
8.2.60.0080.00018.03
8.2.50.0070.00318.07
8.2.40.0060.00321.11
8.2.30.0000.00818.20
8.2.20.0000.00817.61
8.2.10.0080.00017.95
8.2.00.0060.00317.57
8.1.280.0080.01225.92
8.1.270.0060.01023.90
8.1.260.0080.00026.35
8.1.250.0060.00328.09
8.1.240.0060.00323.77
8.1.230.0080.00422.26
8.1.220.0050.00517.76
8.1.210.0040.00418.77
8.1.200.0080.00317.35
8.1.190.0040.00417.22
8.1.180.0060.00318.10
8.1.170.0050.00518.47
8.1.160.0040.00422.08
8.1.150.0000.00718.58
8.1.140.0000.00817.50
8.1.130.0030.00317.85
8.1.120.0000.00817.37
8.1.110.0030.00617.43
8.1.100.0040.00417.43
8.1.90.0000.00817.52
8.1.80.0030.00517.54
8.1.70.0070.00017.39
8.1.60.0000.00917.57
8.1.50.0030.00617.55
8.1.40.0060.00317.55
8.1.30.0080.00017.61
8.1.20.0060.00317.56
8.1.10.0040.00717.58
8.1.00.0030.00617.57
8.0.300.0050.00319.95
8.0.290.0000.00916.75
8.0.280.0040.00418.45
8.0.270.0070.00017.32
8.0.260.0000.00717.20
8.0.250.0000.00717.04
8.0.240.0070.00017.01
8.0.230.0040.00417.06
8.0.220.0000.00816.97
8.0.210.0000.00816.82
8.0.200.0040.00417.00
8.0.190.0030.00616.98
8.0.180.0080.00017.03
8.0.170.0030.00616.91
8.0.160.0040.00416.93
8.0.150.0040.00416.93
8.0.140.0030.00616.82
8.0.130.0030.00313.37
8.0.120.0000.00816.95
8.0.110.0000.00816.81
8.0.100.0020.00516.84
8.0.90.0050.00216.84
8.0.80.0100.00716.91
8.0.70.0000.00816.89
8.0.60.0000.00717.09
8.0.50.0000.00716.98
8.0.30.0150.00717.08
8.0.20.0140.00617.40
8.0.10.0000.00717.11
8.0.00.0120.01016.86
7.4.330.0030.00315.03
7.4.320.0000.00716.39
7.4.300.0070.00016.61
7.4.290.0030.00616.65
7.4.280.0080.00016.59
7.4.270.0000.01116.53
7.4.260.0070.00016.54
7.4.250.0040.00416.56
7.4.240.0050.00216.54
7.4.230.0030.00316.63
7.4.220.0060.01616.74
7.4.210.0130.00516.66
7.4.200.0040.00416.63
7.4.190.0040.00416.47
7.4.160.0100.00816.61
7.4.150.0150.00617.40
7.4.140.0100.01017.86
7.4.130.0140.01016.61
7.4.120.0140.00716.53
7.4.110.0090.01216.52
7.4.100.0100.01016.43
7.4.90.0060.01416.46
7.4.80.0090.01619.39
7.4.70.0140.01116.49
7.4.60.0080.01116.53
7.4.50.0030.00616.23
7.4.40.0080.01116.36
7.4.30.0070.01416.46
7.4.00.0090.00915.01
7.3.330.0040.00313.39
7.3.320.0000.00613.34
7.3.310.0050.00216.42
7.3.300.0040.00416.26
7.3.290.0110.01016.42
7.3.280.0090.01016.39
7.3.270.0080.01217.40
7.3.260.0130.01016.69
7.3.250.0150.00816.37
7.3.240.0100.01016.58
7.3.230.0090.00916.42
7.3.210.0180.00516.56
7.3.200.0030.02016.59
7.3.190.0090.01616.58
7.3.180.0070.01116.72
7.3.170.0130.00916.48
7.3.160.0100.01016.70
7.3.120.0080.01014.83
7.3.110.0030.01114.92
7.3.100.0100.00714.91
7.3.90.0070.01014.68
7.3.80.0070.00914.87
7.3.70.0060.00714.68
7.3.60.0100.00514.81
7.3.50.0080.00814.70
7.3.40.0030.01014.78
7.3.30.0110.00314.79
7.3.20.0110.00316.61
7.3.10.0070.00716.73
7.3.00.0070.00616.57
7.2.330.0120.00816.81
7.2.320.0140.00616.88
7.2.310.0070.01416.82
7.2.300.0110.00716.51
7.2.290.0100.01016.70
7.2.250.0080.01215.23
7.2.240.0060.01315.04
7.2.230.0050.00915.21
7.2.220.0070.00715.20
7.2.210.0040.01615.21
7.2.200.0070.00915.21
7.2.190.0080.01015.11
7.2.180.0030.01015.10
7.2.170.0060.01015.15
7.2.60.0130.00316.90
7.2.00.0040.01119.68
7.1.330.0080.00915.71
7.1.320.0060.00915.85
7.1.310.0090.00615.74
7.1.300.0040.01215.72
7.1.290.0060.00815.73
7.1.280.0080.00815.87
7.1.270.0100.00515.60
7.1.260.0050.00915.75
7.1.200.0060.00915.76
7.1.100.0030.01018.20
7.1.70.0000.01116.93
7.1.60.0030.02319.46
7.1.50.0110.00416.63
7.1.00.0030.07022.57
7.0.200.0040.00416.73
7.0.140.0070.07022.01
7.0.60.0030.08321.67
7.0.50.0100.07722.20
7.0.40.0070.08320.03
7.0.30.0070.07020.19
7.0.20.0000.04320.07
7.0.10.0000.04720.09
7.0.00.0000.04720.01
5.6.280.0070.07321.08
5.6.210.0000.08020.76
5.6.200.0100.07320.99
5.6.190.0070.08321.05
5.6.180.0070.04721.02
5.6.170.0070.04021.02
5.6.160.0070.03721.15
5.6.150.0000.05720.98
5.6.140.0000.04321.03
5.6.130.0030.04321.03
5.6.120.0030.04021.03
5.6.110.0070.04321.01
5.6.100.0000.04321.14
5.6.90.0030.04021.11
5.6.80.0030.03020.52
5.6.70.0070.02720.39
5.6.60.0070.03320.50
5.6.50.0030.03320.52
5.6.40.0030.03020.38
5.6.30.0070.02720.38
5.6.20.0030.03020.36
5.6.10.0000.03320.46
5.6.00.0030.03320.40
5.5.350.0070.07720.45
5.5.340.0030.08720.90
5.5.330.0030.08320.98
5.5.320.0000.09020.98
5.5.310.0000.04320.81
5.5.300.0030.04020.90
5.5.290.0000.04320.78
5.5.280.0100.02720.89
5.5.270.0000.05720.88
5.5.260.0000.03320.86
5.5.250.0000.03720.51
5.5.240.0030.03020.27
5.5.230.0030.03320.04
5.5.220.0030.03320.15
5.5.210.0100.03020.13
5.5.200.0030.03020.24
5.5.190.0000.03720.17
5.5.180.0000.03320.21
5.5.160.0070.02720.32
5.5.150.0030.04020.16
5.5.140.0000.03320.02
5.5.130.0070.04320.10
5.5.120.0070.02720.25
5.5.110.0000.03320.13
5.5.100.0070.03720.13
5.5.90.0070.03720.06
5.5.80.0100.06720.02
5.5.70.0000.04020.09
5.5.60.0030.07320.11
5.5.50.0030.04020.05
5.5.40.0070.07020.05
5.5.30.0070.07720.11
5.5.20.0030.04020.11
5.5.10.0000.04020.09
5.5.00.0000.04720.17
5.4.450.0000.03719.53
5.4.440.0030.03019.52
5.4.430.0030.04019.45
5.4.420.0030.03019.45
5.4.410.0000.05019.36
5.4.400.0000.03019.06
5.4.390.0030.03019.17
5.4.380.0030.03319.09
5.4.370.0000.03019.08
5.4.360.0000.03018.91
5.4.350.0000.03019.01
5.4.340.0000.03319.16
5.4.320.0000.03019.07
5.4.310.0030.03019.07
5.4.300.0030.04019.21
5.4.290.0030.03719.02
5.4.280.0070.03019.12
5.4.270.0070.03319.16
5.4.260.0030.07719.07
5.4.250.0030.08019.01
5.4.240.0000.03719.16
5.4.230.0000.05019.04
5.4.220.0000.06319.16
5.4.210.0000.03719.04
5.4.200.0000.08019.00
5.4.190.0030.07019.00
5.4.180.0070.03319.00
5.4.170.0070.05019.03
5.4.160.0030.07719.05
5.4.150.0000.04318.89
5.4.140.0030.03316.50
5.4.130.0000.03316.47
5.4.120.0000.07316.31
5.4.110.0030.04716.42
5.4.100.0000.07316.40
5.4.90.0000.07016.39
5.4.80.0100.06316.46
5.4.70.0070.07016.50
5.4.60.0030.07316.40
5.4.50.0070.07016.52
5.4.40.0130.07016.41
5.4.30.0030.06316.42
5.4.20.0000.08016.34
5.4.10.0100.06716.51
5.4.00.0000.08015.69
5.3.290.0030.03014.69
5.3.280.0030.03314.59
5.3.270.0000.04714.62
5.3.260.0030.04014.66
5.3.250.0000.04014.48
5.3.240.0030.05714.58
5.3.230.0000.03014.65
5.3.220.0070.07314.54
5.3.210.0030.03314.63
5.3.200.0030.03314.62
5.3.190.0070.07314.67
5.3.180.0030.06714.57
5.3.170.0000.07714.62
5.3.160.0070.07014.67
5.3.150.0070.06314.64
5.3.140.0100.07014.61
5.3.130.0100.04314.63
5.3.120.0000.06014.59
5.3.110.0000.08714.66
5.3.100.0000.04714.04
5.3.90.0070.07314.09
5.3.80.0100.06713.93
5.3.70.0030.07714.07
5.3.60.0000.06314.03
5.3.50.0030.06014.05
5.3.40.0070.07314.05
5.3.30.0030.06014.02
5.3.20.0030.03313.66
5.3.10.0070.06313.70
5.3.00.0030.08013.73
5.2.170.0000.06311.05
5.2.160.0100.05311.20
5.2.150.0000.06311.19
5.2.140.0130.05311.19
5.2.130.0030.06011.17
5.2.120.0030.05710.96
5.2.110.0000.06011.16
5.2.100.0030.05011.09
5.2.90.0130.05011.16
5.2.80.0000.05311.15
5.2.70.0000.04711.15
5.2.60.0030.06011.05
5.2.50.0000.06710.88
5.2.40.0100.05011.10
5.2.30.0030.05711.03
5.2.20.0000.06011.01
5.2.10.0030.04010.98
5.2.00.0000.04710.73
5.1.60.0000.05310.71
5.1.50.0000.03710.71
5.1.40.0000.05710.71
5.1.30.0000.06010.71
5.1.20.0070.04710.71
5.1.10.0070.05310.71
5.1.00.0000.05710.71
5.0.50.0000.04710.71
5.0.40.0000.04310.71
5.0.30.0000.06310.71
5.0.20.0000.04710.71
5.0.10.0030.04310.71
5.0.00.0070.05710.71
4.4.90.0000.03710.71
4.4.80.0030.03710.71
4.4.70.0000.03010.71
4.4.60.0000.02710.71
4.4.50.0000.03310.71
4.4.40.0070.04010.71
4.4.30.0000.03710.71
4.4.20.0030.03010.71
4.4.10.0030.03010.71
4.4.00.0000.03310.71
4.3.110.0030.03310.71
4.3.100.0030.03010.71
4.3.90.0030.03310.71
4.3.80.0070.04710.71
4.3.70.0000.02710.71
4.3.60.0030.03010.71
4.3.50.0030.03310.71
4.3.40.0030.04310.71
4.3.30.0030.03310.71
4.3.20.0030.03710.71
4.3.10.0000.03710.71
4.3.00.0000.03010.71

preferences:
43.1 ms | 401 KiB | 5 Q