3v4l.org

run code in 500+ PHP versions simultaneously
<?php declare(strict_types=1); /** * @template TKey * @template TValue * @implements IteratorAggregate<TKey, TValue> */ final class RewindableGenerator implements IteratorAggregate { /** * @param callable(): Generator<TKey, TValue> $generatorFunction */ public function __construct(private $generatorFunction) {} public function getIterator(): Traversable { return ($this->generatorFunction)(); } } /** * @return Generator<int, int> */ function thousand(): Generator { for ($i = 0; $i < 1000; ++$i) { yield $i; } } $thousand = new RewindableGenerator(thousand(...)); foreach ($thousand as $i); foreach ($thousand as $i); foreach ($thousand as $i);

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.5.80.0040.00316.88
8.5.70.0140.00516.78
8.5.60.0090.00916.91
8.5.50.0060.00216.89
8.5.30.0100.00719.44
8.5.20.0070.01319.52
8.5.10.0080.00920.16
8.5.00.0140.00819.90
8.4.230.0120.00419.50
8.4.220.0120.00619.43
8.4.210.0110.01019.48
8.4.180.0050.00519.72
8.4.170.0140.00923.80
8.4.160.0130.00822.39
8.4.150.0060.00716.82
8.4.140.0140.00817.52
8.4.130.0120.00919.34
8.4.120.0120.00922.37
8.4.110.0070.00218.85
8.4.100.0140.00518.66
8.4.90.0130.00718.94
8.4.80.0030.00518.79
8.4.70.0120.00617.75
8.4.60.0100.01118.75
8.4.50.0070.00217.84
8.4.40.0120.00619.72
8.4.30.0110.00818.76
8.4.20.0000.00919.78
8.4.10.0100.01023.93
8.3.320.0130.00718.63
8.3.310.0090.00918.54
8.3.300.0130.00920.77
8.3.290.0120.00820.66
8.3.280.0120.00818.29
8.3.270.0110.00816.58
8.3.260.0040.00516.72
8.3.250.0110.00816.98
8.3.240.0140.00516.77
8.3.230.0110.01016.62
8.3.220.0120.00719.15
8.3.210.0070.00118.37
8.3.200.0040.00516.95
8.3.190.0090.00616.77
8.3.180.0070.00716.62
8.3.170.0060.01317.12
8.3.160.0180.00316.54
8.3.150.0040.01617.40
8.3.140.0080.00020.93
8.3.130.0080.00018.29
8.3.120.0060.00319.13
8.3.110.0080.00022.58
8.3.100.0040.00420.94
8.3.90.0100.01026.77
8.3.80.0440.00326.77
8.3.70.0440.00626.77
8.3.60.0280.02026.77
8.3.50.0420.00026.77
8.3.40.0310.00626.77
8.3.30.0200.00923.92
8.3.20.0190.01125.12
8.3.10.0230.00825.21
8.3.00.0190.01124.87
8.2.320.0040.00519.86
8.2.310.0100.01018.10
8.2.300.0110.01120.41
8.2.290.0130.00620.30
8.2.280.0130.00818.68
8.2.270.0110.00018.49
8.2.260.0040.00416.51
8.2.250.0050.00318.68
8.2.240.0030.00617.21
8.2.230.0060.00322.58
8.2.220.0060.00322.58
8.2.210.0240.00326.77
8.2.200.0250.00626.77
8.2.190.0140.00526.77
8.2.180.0190.00326.77
8.2.170.0170.00326.77
8.2.160.0230.00424.87
8.2.150.0270.00524.87
8.2.140.0120.01024.87
8.2.130.0210.00524.87
8.2.120.0160.00924.87
8.2.110.0180.00424.87
8.2.100.0160.00824.87
8.2.90.0140.00421.35
8.2.80.0220.01024.87
8.2.70.0210.00922.45
8.2.60.0170.00822.45
8.2.50.0190.00822.45
8.2.40.0230.00822.45
8.2.30.0190.00720.77
8.2.20.0110.00519.98
8.2.10.0140.00419.88
8.2.00.0100.00719.70
8.1.340.0120.00917.43
8.1.330.0140.00622.16
8.1.320.0100.01016.13
8.1.310.0060.00318.58
8.1.300.0070.01117.77
8.1.290.0320.01026.77
8.1.280.0330.00826.77
8.1.270.0230.00625.39
8.1.260.0150.01125.34
8.1.250.0220.00325.24
8.1.240.0250.01024.87
8.1.230.0210.01424.87
8.1.220.0190.01124.87
8.1.210.0250.00524.87
8.1.200.0210.00622.45
8.1.190.0220.00722.45
8.1.180.0220.00622.45
8.1.170.0190.00822.45
8.1.160.0160.00520.66
8.1.150.0110.00519.69
8.1.140.0120.00519.82
8.1.130.0090.00419.04
8.1.120.0070.00518.79
8.1.110.0100.00618.46
8.1.100.0100.00518.44
8.1.90.0110.00518.38
8.1.80.0100.00618.40
8.1.70.0110.00518.41
8.1.60.0120.00518.49
8.1.50.0110.00518.45
8.1.40.0130.00518.50
8.1.30.0130.00518.51
8.1.20.0140.00418.56
8.1.10.0130.00518.48
8.1.00.0130.00518.39
8.0.300.0190.00724.87
8.0.290.0250.00522.45
8.0.280.0160.00620.40
8.0.270.0110.00419.17
8.0.260.0140.00319.12
8.0.250.0090.00517.93
8.0.240.0100.00517.81
8.0.230.0090.00617.81
8.0.220.0110.00517.76
8.0.210.0100.00517.74
8.0.200.0110.00517.81
8.0.190.0100.00517.78
8.0.180.0100.00517.78
8.0.170.0110.00417.81
8.0.160.0100.00517.80
8.0.150.0100.00517.75
8.0.140.0100.00517.73
8.0.130.0100.00417.75
8.0.120.0100.00517.73
8.0.110.0110.00417.74
8.0.100.0100.00517.73
8.0.90.0100.00517.74
8.0.80.0110.00417.74
8.0.70.0100.00517.74
8.0.60.0100.00517.75
8.0.50.0110.00417.73
8.0.30.0110.00417.75
8.0.20.0090.00517.78
8.0.10.0090.00517.80
7.4.330.0090.00415.14
7.4.320.0100.00417.33
7.4.300.0120.00417.34
7.4.290.0120.00517.33
7.4.280.0120.00517.38
7.4.270.0130.00417.40
7.4.260.0110.00417.35
7.4.250.0120.00417.31
7.4.240.0110.00417.32
7.4.230.0110.00417.37
7.4.220.0100.00517.32
7.4.210.0100.00417.32
7.4.200.0090.00517.33
7.4.190.0090.00517.43
7.4.180.0090.00417.43
7.4.160.0100.00417.48
7.4.150.0090.00417.32
7.4.140.0090.00517.33
7.4.130.0090.00417.22
7.4.120.0090.00517.26
7.4.110.0090.00417.35
7.4.100.0090.00417.41
7.4.90.0080.00517.25
7.4.80.0090.00317.40
7.4.70.0070.00517.34
7.4.60.0080.00517.22
7.4.50.0070.00517.26
7.4.40.0080.00417.16
7.4.30.0080.00417.29
7.4.20.0080.00417.51
7.4.10.0080.00417.53
7.4.00.0090.00317.47

preferences:
49.03 ms | 1279 KiB | 5 Q