3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen1() { $x = yield 1; echo "Got $x from a yield\n"; $x = yield 2; echo "Got $x from a yield\n"; $x = yield 3; echo "Got $x from a yield\n"; } function yf($iter) { yield from $iter; } function yfr($iter) { $isSubgenerator = $iter instanceof Generator; foreach($iter as $val) { yield $val; } } // $g = yfr(gen1()); $g = yf(gen1()); $g->next(); var_dump($g->current()); $g->send(10); var_dump($g->current()); $g->send(20); var_dump($g->current());

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.40.0040.01118.67
8.3.30.0110.00418.63
8.3.20.0000.00720.21
8.3.10.0040.00423.48
8.3.00.0050.00319.56
8.2.170.0110.00422.96
8.2.160.0090.00920.35
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0080.00017.75
8.2.110.0100.00021.10
8.2.100.0040.00717.72
8.2.90.0080.00017.63
8.2.80.0050.00318.55
8.2.70.0000.00817.77
8.2.60.0040.00417.63
8.2.50.0000.00817.55
8.2.40.0030.00519.22
8.2.30.0050.00220.66
8.2.20.0050.00317.77
8.2.10.0000.00718.07
8.2.00.0000.00718.00
8.1.270.0090.00624.02
8.1.260.0000.00726.35
8.1.250.0070.00028.09
8.1.240.0060.00321.22
8.1.230.0080.00417.70
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0050.00317.35
8.1.190.0030.00717.13
8.1.180.0030.00618.10
8.1.170.0050.00217.62
8.1.160.0050.00222.07
8.1.150.0000.00918.94
8.1.140.0040.00421.39
8.1.130.0050.00217.77
8.1.120.0000.00817.46
8.1.110.0000.00717.36
8.1.100.0040.00417.47
8.1.90.0070.00017.45
8.1.80.0000.00717.47
8.1.70.0000.00717.45
8.1.60.0020.00517.48
8.1.50.0030.00617.49
8.1.40.0080.00017.55
8.1.30.0040.00417.57
8.1.20.0050.00217.68
8.1.10.0060.00317.53
8.1.00.0000.00817.42
8.0.300.0060.00318.77
8.0.290.0000.00716.63
8.0.280.0040.00418.48
8.0.270.0050.00317.26
8.0.260.0000.00717.18
8.0.250.0000.00716.95
8.0.240.0050.00216.92
8.0.230.0070.00016.93
8.0.220.0040.00316.79
8.0.210.0000.00816.94
8.0.200.0030.00316.95
8.0.190.0040.00416.93
8.0.180.0040.00416.93
8.0.170.0050.00316.90
8.0.160.0040.00416.95
8.0.150.0080.00016.78
8.0.140.0040.00316.90
8.0.130.0030.00513.30
8.0.120.0080.00016.88
8.0.110.0040.00416.79
8.0.100.0000.00816.73
8.0.90.0080.00016.82
8.0.80.0060.01416.93
8.0.70.0000.00816.79
8.0.60.0040.00416.89
8.0.50.0080.00016.87
8.0.30.0100.01817.04
8.0.20.0090.01017.40
8.0.10.0030.00416.84
8.0.00.0080.01116.69
7.4.330.0000.00515.14
7.4.320.0030.00316.43
7.4.300.0000.00716.57
7.4.290.0030.00316.50
7.4.280.0030.00616.50
7.4.270.0070.00016.66
7.4.260.0000.00716.64
7.4.250.0020.00516.56
7.4.240.0070.00016.51
7.4.230.0000.00816.61
7.4.220.0070.01016.54
7.4.210.0030.01616.69
7.4.200.0030.00316.41
7.4.160.0130.00316.44
7.4.150.0090.00917.40
7.4.140.0110.00817.86
7.4.130.0140.00516.54
7.4.120.0070.01116.72
7.4.110.0110.00816.70
7.4.100.0030.01516.65
7.4.90.0060.01516.50
7.4.80.0170.00219.39
7.4.70.0080.00916.46
7.4.60.0060.00916.43
7.4.50.0040.00016.42
7.4.40.0070.01016.71
7.4.30.0030.02016.46
7.4.00.0060.00615.05
7.3.330.0000.00513.21
7.3.320.0000.00713.31
7.3.310.0030.00316.29
7.3.300.0040.00416.40
7.3.290.0080.00616.42
7.3.280.0080.01016.43
7.3.270.0000.01717.40
7.3.260.0120.00416.39
7.3.250.0130.00516.52
7.3.240.0100.00916.36
7.3.230.0150.00716.39
7.3.210.0100.01016.63
7.3.200.0100.00616.73
7.3.190.0180.00416.28
7.3.180.0080.01216.35
7.3.170.0090.00616.42
7.3.160.0120.00616.62
7.3.10.0070.00716.71
7.3.00.0030.00716.71
7.2.330.0170.00016.73
7.2.320.0070.01116.73
7.2.310.0170.00716.75
7.2.300.0070.01016.45
7.2.290.0040.01916.75
7.2.130.0040.01117.11
7.2.120.0090.00016.89
7.2.110.0040.00817.01
7.2.100.0050.00516.92
7.2.90.0130.00017.05
7.2.80.0060.00317.10
7.2.70.0110.00016.92
7.2.60.0080.00517.02
7.2.50.0000.01416.85
7.2.40.0060.00316.88
7.2.30.0130.00017.00
7.2.20.0070.00716.92
7.2.10.0000.00916.93
7.2.00.0040.00918.19
7.1.250.0030.01015.60
7.1.200.0030.00315.53
7.1.100.0040.01118.14
7.1.70.0110.00417.18
7.1.60.0170.00719.50
7.1.50.0170.00316.85
7.1.00.0000.07022.43
7.0.200.0000.00716.38
7.0.60.0100.04319.86
7.0.50.0000.04717.92
7.0.40.0100.08320.25
7.0.30.0230.07720.28
7.0.20.0170.07020.22
7.0.10.0270.07320.12
7.0.00.0030.08720.16
5.6.280.0000.05321.08
5.6.210.0000.06720.49
5.6.200.0100.07018.29
5.6.190.0030.05320.61
5.6.180.4170.04020.56
5.6.170.0230.08320.50
5.6.160.0100.08020.56
5.6.150.0070.05018.19
5.6.140.0030.08018.24
5.6.130.0100.06318.14
5.6.120.0070.08721.14
5.6.110.0070.07721.13
5.6.100.0170.06021.07
5.6.90.0130.03721.02
5.6.80.0100.07320.38
5.5.350.0070.07720.30
5.5.340.0130.07017.96
5.5.330.0130.04020.57
5.5.320.0070.04720.31
5.5.310.0300.07320.27
5.5.300.0070.06318.08
5.5.290.0030.04317.95
5.5.280.0030.06720.65
5.5.270.0100.08320.76
5.5.260.0070.05020.83
5.5.250.0130.06320.69
5.5.240.0030.05720.26
5.4.450.1030.05319.59
5.4.440.0770.06719.55
5.4.430.0870.06719.46
5.4.420.0830.05319.16
5.4.410.1030.06719.34
5.4.400.0900.05319.38
5.4.390.0970.05319.15
5.4.380.0800.06019.23
5.4.370.0730.05319.38
5.4.360.0730.07019.25
5.4.350.0830.05319.06
5.4.340.0900.04719.01
5.4.320.0930.04319.02
5.4.310.0700.05719.01
5.4.300.0700.06019.12
5.4.290.0930.04718.98
5.4.280.0830.05319.22
5.4.270.1000.07019.26
5.4.260.0930.05019.38
5.4.250.0900.05718.87
5.4.240.0670.05019.14
5.4.230.0730.04719.30
5.4.220.0600.05719.05
5.4.210.0630.05019.14
5.4.200.0630.05319.00
5.4.190.0700.05019.13
5.4.180.0630.05019.25
5.4.170.0630.05018.97
5.4.160.0570.05319.04
5.4.150.0630.05318.81
5.4.140.0800.06316.54
5.4.130.0830.04716.52
5.4.120.0800.05016.41
5.4.110.1000.05016.25
5.4.100.1000.05716.21
5.4.90.0900.05716.42
5.4.80.0700.04716.61
5.4.70.0930.04016.59
5.4.60.1000.06016.62
5.4.50.0770.04716.41
5.4.40.0630.05016.58
5.4.30.0630.04716.48
5.4.20.0670.05716.54
5.4.10.0730.05016.25
5.4.00.0800.05015.91

preferences:
51.69 ms | 400 KiB | 5 Q