3v4l.org

run code in 300+ PHP versions simultaneously
<?php function xrange($start, $end, $step = 1) { while ($start <= $end) { yield $start; $start += $step; } } function reduce(Generator $iterator, Callable $callback, $initial = null) { $result = $initial; foreach($iterator as $value) { $result = $callback($result, $value); } return $result; } $start = microtime(true); reduce(xrange(1, 140000), function($r, $v) {return $r + $v;}, 0); $byGen = microtime(true) - $start; $start =microtime(true); array_reduce(range(1,140000), function($r, $v) {return $r + $v;}, 0); $byNormal = microtime(true) - $start; $percent = ($byGen - $byNormal)*100/$byNormal; printf("Generator is %s than normal function %.2f%%.\n", ($byGen > $byNormal ? 'Slower' : 'Faster'), abs($percent));

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)
7.4.80.0130.03020.56
7.4.70.0130.03320.38
7.4.60.0160.03220.57
7.4.50.0090.03720.43
7.4.40.0130.03420.33
7.4.30.0040.04020.61
7.4.20.0190.04620.43
7.4.10.0120.03220.51
7.4.00.0140.03920.00
7.3.200.0120.03420.41
7.3.190.0210.03520.39
7.3.180.0180.02920.41
7.3.170.0180.02820.55
7.3.160.0140.03220.42
7.3.150.0100.04520.65
7.3.140.0070.05920.28
7.3.130.0120.05020.42
7.3.120.0150.04219.87
7.3.110.0080.03919.98
7.3.100.0090.03219.90
7.3.90.0090.03020.05
7.3.80.0110.02920.01
7.3.70.0110.02919.97
7.3.60.0060.03419.92
7.3.50.0060.03220.01
7.3.40.0110.03719.89
7.3.30.0060.03619.92
7.3.20.0120.02922.31
7.3.10.0050.03122.33
7.3.00.0130.03222.41
7.2.320.0130.05620.81
7.2.310.0160.02920.66
7.2.300.0130.05820.84
7.2.290.0150.03520.75
7.2.280.0190.03020.77
7.2.270.0130.03820.84
7.2.260.0130.04420.86
7.2.250.0130.03820.10
7.2.240.0160.03520.34
7.2.230.0100.04320.24
7.2.220.0080.03220.35
7.2.210.0110.03520.16
7.2.200.0110.03020.04
7.2.190.0090.03120.08
7.2.180.0070.03920.09
7.2.170.0110.03420.19
7.2.160.0110.03820.69
7.2.150.0150.03222.56
7.2.140.0150.03122.53
7.2.130.0120.04022.70
7.2.120.0040.04322.67
7.2.110.0120.03522.61
7.2.100.0170.03922.65
7.2.90.0200.03722.58
7.2.80.0160.03822.65
7.2.70.0120.03522.75
7.2.60.0150.02722.67
7.2.50.0130.03822.76
7.2.40.0120.03322.73
7.2.30.0160.04222.79
7.2.20.0120.03222.67
7.2.10.0140.03722.63
7.2.00.0160.03923.66
7.1.330.0180.03621.71
7.1.320.0160.04721.61
7.1.310.0130.04121.57
7.1.300.0130.03921.56
7.1.290.0240.05121.72
7.1.280.0110.04721.52
7.1.270.0170.04021.56
7.1.260.0140.04321.58
7.1.250.0300.04121.52
7.1.240.0150.04221.62
7.1.230.0210.04821.57
7.1.220.0130.05021.59
7.1.210.0220.04121.61
7.1.200.0200.05121.58
7.1.190.0180.03921.60
7.1.180.0220.04421.51
7.1.170.0160.04421.51
7.1.160.0250.04121.60
7.1.150.0190.04421.59
7.1.140.0260.03721.44
7.1.130.0160.04021.60
7.1.120.0230.04822.87
7.1.110.0160.04022.50
7.1.100.0160.04422.50
7.1.90.0160.04222.50
7.1.80.0120.04722.58
7.1.70.0160.04122.15
7.1.60.0210.04329.36
7.1.50.0180.05029.30
7.1.40.0300.05029.16
7.1.30.0160.04929.14
7.1.20.0190.04429.21
7.1.10.0110.04921.90
7.1.00.0140.04321.89
7.0.330.0200.04221.24
7.0.320.0200.05221.21
7.0.310.0160.05321.29
7.0.300.0320.04521.22
7.0.290.0180.03821.24
7.0.280.0210.03621.29
7.0.270.0250.03921.16
7.0.260.0220.04621.19
7.0.250.0160.03821.36
7.0.240.0210.05521.33
7.0.230.0210.04421.32
7.0.220.0180.04121.38
7.0.210.0320.04221.19
7.0.200.0140.04021.22
7.0.190.0100.05021.28
7.0.180.0100.04721.29
7.0.170.0210.03621.41
7.0.160.0170.04321.17
7.0.150.0220.04321.27
7.0.140.0160.03821.10
7.0.130.0180.04921.46
7.0.120.0420.03821.31
7.0.110.0130.06321.24
7.0.100.0160.04821.36
7.0.90.0150.06321.18
7.0.80.0160.05021.13
7.0.70.0210.04821.24
7.0.60.0280.04421.41
7.0.50.0250.05621.24
7.0.40.0180.05120.26
7.0.30.0180.05120.25
7.0.20.0170.04420.32
7.0.10.0130.05020.16
7.0.00.0320.05720.15
5.6.400.0230.15036.24
5.6.390.0300.14936.33
5.6.380.0210.14235.88
5.6.370.0270.13136.38
5.6.360.0250.15036.21
5.6.350.0270.15736.16
5.6.340.0360.14936.20
5.6.330.0250.12836.47
5.6.320.0340.12636.14
5.6.310.0250.12536.26
5.6.300.0170.13336.36
5.6.290.0310.11936.34
5.6.280.0250.13836.35
5.6.270.0190.16736.28
5.6.260.0310.15736.52
5.6.250.0320.15736.40
5.6.240.0260.13536.28
5.6.230.0250.13336.20
5.6.220.0280.13136.28
5.6.210.0280.12336.28
5.6.200.0260.12336.34
5.6.190.0320.13336.38
5.6.180.0270.15436.25
5.6.170.0280.12336.36
5.6.160.0240.12936.33
5.6.150.0340.11936.13
5.6.140.0240.12536.36
5.6.130.0330.12236.32
5.6.120.0220.13336.20
5.6.110.0370.12936.17
5.6.100.0250.14836.22
5.6.90.0250.12536.45
5.6.80.0260.15636.17
5.6.70.0230.15836.29
5.6.60.0270.13436.19
5.6.50.0290.15636.21
5.6.40.0290.12136.21
5.6.30.0290.12636.21
5.6.20.0360.17436.32
5.6.10.0190.12336.16
5.6.00.0300.13236.27
5.5.380.0310.14136.43
5.5.370.0390.18836.21
5.5.360.0480.13036.12
5.5.350.0600.16936.37
5.5.340.0420.12336.29
5.5.330.0400.12036.29
5.5.320.0530.17036.25
5.5.310.0360.13136.52
5.5.300.0360.18136.18
5.5.290.0380.12236.32
5.5.280.0380.15836.13
5.5.270.0470.13836.00
5.5.260.0350.15236.22
5.5.250.0320.13036.13
5.5.240.0370.12335.97
5.5.230.0310.13236.22
5.5.220.0440.11236.18
5.5.210.0310.16936.10
5.5.200.0590.16936.32
5.5.190.0430.18036.07
5.5.180.0450.17136.23
5.5.170.0330.12935.97
5.5.160.0370.13136.20
5.5.150.0390.18036.27
5.5.140.0300.13636.32
5.5.130.0550.10936.28
5.5.120.0390.11836.26
5.5.110.0520.13235.98
5.5.100.0500.11436.05
5.5.90.0320.13936.12
5.5.80.0450.12336.23
5.5.70.0490.14436.31
5.5.60.0420.12936.17
5.5.50.0300.16736.32
5.5.40.0460.11236.22
5.5.30.0430.15636.22
5.5.20.0440.12436.28
5.5.10.0410.13036.04
5.5.00.0460.13236.17
5.4.450.0170.00812.55
5.4.440.0160.00912.67
5.4.430.0090.01312.43
5.4.420.0150.01112.50
5.4.410.0210.00512.33
5.4.400.0240.00312.45
5.4.390.0190.00612.45
5.4.380.0190.01012.38
5.4.370.0080.01612.19
5.4.360.0190.00412.30
5.4.350.0200.00812.40
5.4.340.0160.00912.36
5.4.330.0120.01212.36
5.4.320.0150.01112.49
5.4.310.0180.00612.34
5.4.300.0200.00612.52
5.4.290.0130.01012.24
5.4.280.0180.01112.21
5.4.270.0190.00512.36
5.4.260.0170.01012.46
5.4.250.0200.00912.40
5.4.240.0170.00512.31
5.4.230.0200.00912.25
5.4.220.0180.00612.29
5.4.210.0160.00612.20
5.4.200.0150.00812.21
5.4.190.0190.00712.55
5.4.180.0160.01212.41
5.4.170.0200.00812.39
5.4.160.0170.01412.62
5.4.150.0170.00912.37
5.4.140.0160.01212.60
5.4.130.0200.01212.36
5.4.120.0160.00812.67
5.4.110.0230.00312.44
5.4.100.0220.00612.38
5.4.90.0220.01512.36
5.4.80.0130.01312.37
5.4.70.0170.01312.44
5.4.60.0170.00612.39
5.4.50.0140.01012.32
5.4.40.0320.00012.43
5.4.30.0180.00912.32
5.4.20.0130.01312.42
5.4.10.0170.01012.46
5.4.00.0150.01212.43
5.3.290.0130.01612.97
5.3.280.0170.00712.65
5.3.270.0190.00912.87
5.3.260.0180.01412.71
5.3.250.0190.00612.86
5.3.240.0130.01712.54
5.3.230.0180.00912.81
5.3.220.0240.00412.79
5.3.210.0150.01512.79
5.3.200.0280.00312.83
5.3.190.0210.00912.77
5.3.180.0210.01212.84
5.3.170.0220.00712.88
5.3.160.0140.01112.84
5.3.150.0190.00912.83
5.3.140.0130.01012.82
5.3.130.0140.01012.93
5.3.120.0190.00612.91
5.3.110.0100.02012.92
5.3.100.0160.01012.83
5.3.90.0140.01112.90
5.3.80.0120.01212.77
5.3.70.0110.01712.71
5.3.60.0250.00412.95
5.3.50.0100.01612.69
5.3.40.0130.01312.84
5.3.30.0190.01012.71
5.3.20.0080.01612.67
5.3.10.0130.01312.48
5.3.00.0150.01012.50
5.2.170.0130.01311.74
5.2.160.0130.01011.85
5.2.150.0130.00912.06
5.2.140.0130.01011.72
5.2.130.0160.00411.90
5.2.120.0120.01211.87
5.2.110.0150.00611.86
5.2.100.0070.01411.91
5.2.90.0070.01411.88
5.2.80.0170.00711.75
5.2.70.0130.00911.75
5.2.60.0120.00811.73
5.2.50.0170.00811.84
5.2.40.0120.00911.70
5.2.30.0140.00711.81
5.2.20.0150.00611.52
5.2.10.0130.00811.59
5.2.00.0130.01011.52
5.1.60.0150.00410.93
5.1.50.0070.01410.80
5.1.40.0160.00310.88
5.1.30.0100.01011.00
5.1.20.0150.00610.82
5.1.10.0160.00611.15
5.1.00.0190.00310.67
5.0.50.0120.00610.43
5.0.40.0070.00910.43
5.0.30.0090.01010.43
5.0.20.0080.01110.43
5.0.10.0120.00410.43
5.0.00.0080.00910.43
4.4.90.0080.00310.43
4.4.80.0050.00510.43
4.4.70.0060.00310.43
4.4.60.0040.00710.43
4.4.50.0080.00410.43
4.4.40.0080.00310.43
4.4.30.0070.00310.43
4.4.20.0000.01410.43
4.4.10.0090.00310.43
4.4.00.0080.00310.43
4.3.110.0080.00310.43
4.3.100.0060.00610.43
4.3.90.0070.00410.43
4.3.80.0020.00710.43
4.3.70.0100.00010.43
4.3.60.0100.00010.43
4.3.50.0050.00510.43
4.3.40.0050.00510.43
4.3.30.0000.00810.43
4.3.20.0060.00310.43
4.3.10.0050.00510.43
4.3.00.0000.00910.43

preferences:
55.42 ms | 400 KiB | 5 Q