3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Everything you enter here will be executed by our servers. Try it! function iterator_pipeline(\Traversable $source, $steps) { $gen = $source; foreach ($steps as $step) { 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; } } function iterator_drain(\Traversable $it) { foreach ($it as $key => $value) {} } function iterator_pass(\Traversable $it) { foreach ($it as $key => $value) { yield $key => $value; } } $steps = [ function($it) { foreach ($it as $val) { yield chr($val); } }, "iterator_pass", ["iterator_chunk", 32], "iterator_drain" ]; $it = iterator_pipeline(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.0100.01018.55
8.3.50.0120.01017.53
8.3.40.0120.00318.96
8.3.30.0120.00418.79
8.3.20.0030.00518.90
8.3.10.0040.00420.36
8.3.00.0060.00317.59
8.2.180.0150.00318.54
8.2.170.0090.00622.96
8.2.160.0030.01022.10
8.2.150.0040.00424.18
8.2.140.0000.00724.66
8.2.130.0030.00626.16
8.2.120.0000.00819.81
8.2.110.0090.00020.85
8.2.100.0080.00417.97
8.2.90.0040.00419.16
8.2.80.0040.00418.05
8.2.70.0000.00817.63
8.2.60.0030.00517.93
8.2.50.0080.00018.07
8.2.40.0080.00019.95
8.2.30.0040.00418.23
8.2.20.0030.00517.91
8.2.10.0040.00417.84
8.2.00.0080.00317.98
8.1.280.0140.00725.92
8.1.270.0060.00624.66
8.1.260.0000.00826.35
8.1.250.0090.00028.09
8.1.240.0080.00022.48
8.1.230.0070.00420.88
8.1.220.0040.00417.79
8.1.210.0080.00018.97
8.1.200.0040.00417.36
8.1.190.0040.00417.53
8.1.180.0090.00018.10
8.1.170.0000.00818.78
8.1.160.0040.00418.98
8.1.150.0000.00718.74
8.1.140.0030.00617.46
8.1.130.0000.00817.93
8.1.120.0040.00417.41
8.1.110.0080.00017.45
8.1.100.0000.00817.47
8.1.90.0000.00817.42
8.1.80.0000.00817.51
8.1.70.0000.00717.38
8.1.60.0080.00017.62
8.1.50.0070.00017.58
8.1.40.0070.00017.60
8.1.30.0060.00317.65
8.1.20.0030.00517.70
8.1.10.0000.00817.61
8.1.00.0110.00017.58
8.0.300.0080.00019.98
8.0.290.0000.00716.88
8.0.280.0030.00318.35
8.0.270.0000.00717.30
8.0.260.0030.00316.85
8.0.250.0000.00817.03
8.0.240.0030.00617.04
8.0.230.0000.00717.00
8.0.220.0040.00416.94
8.0.210.0030.00316.89
8.0.200.0040.00417.10
8.0.190.0070.00417.10
8.0.180.0070.00017.02
8.0.170.0030.00617.04
8.0.160.0000.00717.03
8.0.150.0030.00616.92
8.0.140.0030.00716.98
8.0.130.0050.00013.46
8.0.120.0040.00416.96
8.0.110.0040.00417.12
8.0.100.0000.00817.02
8.0.90.0050.00317.05
8.0.80.0040.01216.96
8.0.70.0000.00816.84
8.0.60.0000.00717.02
8.0.50.0000.00816.99
8.0.30.0070.01117.31
8.0.20.0050.01417.16
8.0.10.0050.00317.13
8.0.00.0100.00716.89
7.4.330.0050.00013.07
7.4.320.0000.00716.64
7.4.300.0000.00616.57
7.4.290.0030.00316.49
7.4.280.0030.00616.63
7.4.270.0000.00716.55
7.4.260.0000.00513.28
7.4.250.0040.00416.65
7.4.240.0030.00316.59
7.4.230.0000.00716.64
7.4.220.0060.01016.59
7.4.210.0060.01016.55
7.4.200.0040.00416.66
7.4.190.0030.00316.81
7.4.160.0120.00316.74
7.4.150.0100.01316.57
7.4.140.0080.01016.56
7.4.130.0090.01016.66
7.4.120.0090.00916.66
7.4.110.0070.01016.75
7.4.100.0090.00916.55
7.4.90.0140.00316.60
7.4.80.0080.01116.70
7.4.70.0070.01016.39
7.4.60.0100.00716.52
7.4.50.0000.00616.40
7.4.40.0030.00616.49
7.4.30.0070.01016.39
7.4.00.0080.00814.98
7.3.330.0030.00313.51
7.3.320.0030.00313.42
7.3.310.0070.00016.46
7.3.300.0000.00716.45
7.3.290.0100.01016.44
7.3.280.0110.00616.46
7.3.270.0100.00716.53
7.3.260.0100.01016.56
7.3.250.0120.01216.42
7.3.240.0110.00716.56
7.3.230.0030.01416.54
7.3.210.0060.01616.39
7.3.200.0060.01319.39
7.3.190.0130.01016.59
7.3.180.0090.00616.52
7.3.170.0060.00916.41
7.3.160.0110.00516.45
7.3.120.0020.01315.01
7.3.110.0060.00714.89
7.3.100.0070.00714.86
7.3.90.0080.00614.81
7.3.80.0090.00614.95
7.3.70.0050.00714.77
7.3.60.0050.00814.88
7.3.50.0070.00714.60
7.3.40.0010.01614.86
7.3.30.0070.00614.74
7.3.20.0070.00816.81
7.3.10.0080.00416.82
7.3.00.0070.00916.59
7.2.330.0060.01216.77
7.2.320.0170.00316.83
7.2.310.0090.01616.90
7.2.300.0110.00716.86
7.2.290.0030.01316.74
7.2.250.0080.00415.19
7.2.240.0080.01015.10
7.2.230.0060.00915.11
7.2.220.0050.01115.20
7.2.210.0070.00915.04
7.2.200.0070.00915.13
7.2.190.0060.00714.99
7.2.180.0120.00215.01
7.2.170.0030.01215.12
7.2.160.0050.00715.11
7.2.150.0060.00616.79
7.2.140.0020.01216.76
7.2.130.0080.00716.77
7.2.120.0090.00816.93
7.2.110.0070.00816.96
7.2.100.0060.01016.97
7.2.90.0100.00416.89
7.2.80.0030.01116.89
7.2.70.0110.00417.05
7.2.60.0100.00716.88
7.2.50.0050.00917.02
7.2.40.0050.00816.91
7.2.30.0070.00816.92
7.2.20.0090.00616.76
7.2.10.0050.00716.91
7.2.00.0090.00617.61
7.1.330.0050.00915.88
7.1.320.0040.01015.63
7.1.310.0070.00915.73
7.1.300.0040.00815.92
7.1.290.0060.00915.66
7.1.280.0060.00615.63
7.1.270.0030.00915.63
7.1.260.0080.00415.89
7.1.250.0070.00415.75
7.1.240.0070.00315.45
7.1.230.0030.01515.64
7.1.220.0060.00615.82
7.1.210.0030.01015.85
7.1.200.0070.00315.63
7.1.190.0100.00315.88
7.1.180.0030.01315.83
7.1.170.0080.00415.88
7.1.160.0070.00315.71
7.1.150.0090.00915.68
7.1.140.0030.00715.77
7.1.130.0040.00715.75
7.1.120.0070.01015.83
7.1.110.0040.00815.91
7.1.100.0070.00616.84
7.1.90.0060.00615.87
7.1.80.0070.00715.76
7.1.70.0070.00016.50
7.1.60.0050.01017.65
7.1.50.0070.01116.47
7.1.40.0000.00915.71
7.1.30.0000.01515.85
7.1.20.0100.00315.78
7.1.10.0040.01115.55
7.1.00.0030.02218.97
7.0.330.0030.00915.44
7.0.320.0030.01015.42
7.0.310.0000.00715.50
7.0.300.0090.00615.23
7.0.290.0090.00315.40
7.0.280.0030.00715.05
7.0.270.0030.01015.39
7.0.260.0100.00315.14
7.0.250.0040.00415.36
7.0.240.0070.00715.55
7.0.230.0030.00915.21
7.0.220.0030.00915.45
7.0.210.0040.00415.40
7.0.200.0050.00716.00
7.0.190.0040.00415.38
7.0.180.0000.00815.24
7.0.170.0030.00515.43
7.0.160.0040.00415.54
7.0.150.0100.00615.19
7.0.140.0030.04318.71
7.0.130.0060.00615.25
7.0.120.0030.04118.57
7.0.110.0070.04417.73
7.0.100.0070.04617.74
7.0.90.0020.05217.60
7.0.80.0020.03017.71
7.0.70.0130.02317.74
7.0.60.0020.04217.67
7.0.50.0070.04217.71
7.0.40.0050.02116.69
7.0.30.0070.01816.52
7.0.20.0050.04716.62
7.0.10.0070.02016.33
7.0.00.0100.04016.55
5.6.400.0100.00014.36
5.6.390.0000.01214.45
5.6.380.0130.00314.55
5.6.370.0080.00014.52
5.6.360.0030.01014.48
5.6.350.0030.00714.58
5.6.340.0090.00914.86
5.6.330.0040.01114.70
5.6.320.0090.00014.29
5.6.310.0120.00014.41
5.6.300.0070.00314.68
5.6.290.0030.01014.48
5.6.280.0000.04117.86
5.6.270.0030.01314.20
5.6.260.0110.03517.61
5.6.250.0020.05017.64
5.6.240.0080.04317.56
5.6.230.0060.04417.43
5.6.220.0060.04117.46
5.6.210.0110.03717.57
5.6.200.0030.04417.55
5.6.190.0030.03917.50
5.6.180.0120.03817.46
5.6.170.0030.02217.44
5.6.160.0070.02017.58
5.6.150.0040.03317.56
5.6.140.0070.04717.68
5.6.130.0030.04317.48
5.6.120.0050.04717.62
5.6.110.0090.04317.47
5.6.100.0080.04117.59
5.6.90.0150.03717.52
5.6.80.0050.04717.33
5.6.70.0110.03917.06
5.6.60.0050.04617.27
5.6.50.0070.03717.27
5.6.40.0030.04717.11
5.6.30.0080.03317.21
5.6.20.0100.03617.13
5.6.10.0070.04517.19
5.6.00.0100.03017.14
5.5.380.0050.03315.83
5.5.370.0050.04316.16
5.5.360.0060.04816.03
5.5.350.0030.04216.05
5.5.340.0090.01916.23
5.5.330.0040.04316.21
5.5.320.0080.02516.21
5.5.310.0050.03816.32
5.5.300.0090.04016.46
5.5.290.0120.03816.49
5.5.280.0100.03216.28
5.5.270.0050.04416.21
5.5.260.0080.03316.11
5.5.250.0050.03915.81
5.5.240.0120.03515.94
5.5.230.0080.03815.80
5.5.220.0020.04615.97
5.5.210.0050.02715.97
5.5.200.0070.03515.92
5.5.190.0080.04015.80
5.5.180.0080.04015.74
5.5.170.0000.01314.07
5.5.160.0020.04215.71
5.5.150.0030.03115.98
5.5.140.0060.04115.86
5.5.130.0070.04015.88
5.5.120.0040.04515.77
5.5.110.0050.04415.91
5.5.100.0050.04415.98
5.5.90.0070.04115.84
5.5.80.0070.03815.92
5.5.70.0070.04115.92
5.5.60.0040.04415.98
5.5.50.0120.02415.75
5.5.40.0020.04615.96
5.5.30.0090.03716.00
5.5.20.0070.03815.86
5.5.10.0040.04415.85
5.5.00.0050.03815.85
5.4.450.0030.04515.35
5.4.440.0050.04615.31
5.4.430.0070.04015.43
5.4.420.0120.03315.24
5.4.410.0030.04115.31
5.4.400.0080.03815.19
5.4.390.0130.03315.10
5.4.380.0080.04015.09
5.4.370.0030.04515.21
5.4.360.0080.03615.21
5.4.350.0070.02315.19
5.4.340.0030.02815.17
5.4.330.0000.00711.20
5.4.320.0060.02515.23
5.4.310.0070.03715.20
5.4.300.0070.03715.17
5.4.290.0050.04115.09
5.4.280.0090.02615.10
5.4.270.0050.04015.14
5.4.260.0050.03815.10
5.4.250.0090.03815.18
5.4.240.0100.03815.18
5.4.230.0080.03815.17
5.4.220.0120.02915.21
5.4.210.0100.03715.19
5.4.200.0060.04015.26
5.4.190.0030.03015.11
5.4.180.0120.03215.09
5.4.170.0090.03515.17
5.4.160.0070.03815.25
5.4.150.0060.02915.17
5.4.140.0030.04113.84
5.4.130.0070.02013.89
5.4.120.0000.04213.80
5.4.110.0060.04013.91
5.4.100.0020.03913.90
5.4.90.0000.02113.85
5.4.80.0050.03613.90
5.4.70.0030.03913.91
5.4.60.0020.01913.84
5.4.50.0030.03613.83
5.4.40.0060.03313.81
5.4.30.0050.03813.86
5.4.20.0040.03613.83
5.4.10.0080.03313.88
5.4.00.0020.02213.63
5.3.290.0030.02212.93
5.3.280.0060.03712.90
5.3.270.0060.02112.98
5.3.260.0070.03512.91
5.3.250.0000.02312.95
5.3.240.0050.01812.97
5.3.230.0040.04012.97
5.3.220.0020.04212.89
5.3.210.0000.04513.01
5.3.200.0060.03612.90
5.3.190.0020.04512.93
5.3.180.0070.03512.87
5.3.170.0100.03412.95
5.3.160.0020.04112.89
5.3.150.0050.04012.92
5.3.140.0030.03912.89
5.3.130.0090.03512.88
5.3.120.0030.04012.86
5.3.110.0070.03912.99
5.3.100.0070.04312.69
5.3.90.0050.03912.62
5.3.80.0100.03212.63
5.3.70.0010.04012.66
5.3.60.0050.03312.64
5.3.50.0030.04012.60
5.3.40.0070.02712.57
5.3.30.0050.03912.57
5.3.20.0070.03412.49
5.3.10.0020.03812.47
5.3.00.0030.02712.35
5.2.170.0130.05313.01
5.2.160.0100.05713.01
5.2.150.0070.07313.01
5.2.140.0130.04313.01
5.2.130.0070.05713.01
5.2.120.0030.03313.01
5.2.110.0000.05013.01
5.2.100.0100.05313.01
5.2.90.0070.05713.01
5.2.80.0070.06713.01
5.2.70.0030.05713.01
5.2.60.0100.04313.01
5.2.50.0030.04013.01
5.2.40.0070.02713.01
5.2.30.0030.04313.01
5.2.20.0030.05313.01
5.2.10.0030.05313.01
5.2.00.0030.06713.01
5.1.60.0030.05313.01
5.1.50.0070.05013.01
5.1.40.0000.03313.01
5.1.30.0030.03313.01
5.1.20.0030.05013.01
5.1.10.0030.03013.01
5.1.00.0100.04713.01
5.0.50.0070.04013.01
5.0.40.0030.04013.01
5.0.30.0030.05713.01
5.0.20.0030.04013.01
5.0.10.0030.02313.01
5.0.00.0070.03313.01
4.4.90.0030.01313.01
4.4.80.0000.01713.01
4.4.70.0000.03713.01
4.4.60.0030.01313.01
4.4.50.0000.01713.01
4.4.40.0070.05013.01
4.4.30.0070.03013.01
4.4.20.0030.03313.01
4.4.10.0000.02713.01
4.4.00.0070.03713.01
4.3.110.0000.02313.01
4.3.100.0000.03713.01
4.3.90.0030.02313.01
4.3.80.0030.02713.01
4.3.70.0000.03313.01
4.3.60.0000.03713.01
4.3.50.0000.03313.01
4.3.40.0000.04713.01
4.3.30.0030.03313.01
4.3.20.0030.02713.01
4.3.10.0030.03313.01
4.3.00.0000.03713.01

preferences:
49.46 ms | 401 KiB | 5 Q