3v4l.org

run code in 300+ PHP versions simultaneously
<?php $memoize = function ($fn, $cacheKeyFn = null, $limit = null) { $cache = array(); return function () use ($fn, $cacheKeyFn, $limit, & $cache) { $args = func_get_args(); if ($cacheKeyFn) { $key = call_user_func_array($cacheKeyFn, $args); } else { $key = reset($args); } if (isset($cache[$key])) { return $cache[$key]; } $result = call_user_func_array($fn, $args); if ($limit !== null && count($cache) === $limit) { array_shift($cache); } $cache[$key] = $result; return $result; }; }; $numCalls = 0; $memoFib = $memoize( function ($n) use (& $memoFib, & $numCalls) { $numCalls++; if ($n === 1 || $n === 2) return 1; return $memoFib($n - 1) + $memoFib($n - 2); } ); foreach (range(0,1) as $i) { $memoFib($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.3.70.0670.02780.38
8.3.60.0960.02380.12
8.3.50.0630.03881.11
8.3.40.0440.01648.43
8.3.30.0390.01048.79
8.3.20.0260.00449.97
8.3.10.0230.01651.61
8.3.00.0170.01047.29
8.2.180.0560.03380.25
8.2.170.0430.00748.41
8.2.160.0270.02349.71
8.2.150.0270.00048.64
8.2.140.0210.00748.88
8.2.130.0170.02049.85
8.2.120.0110.00548.87
8.2.110.0140.01450.07
8.2.100.0140.02447.59
8.2.90.0180.00948.72
8.2.80.0070.02147.00
8.2.70.0140.01446.88
8.2.60.0140.01447.55
8.2.50.0230.00347.10
8.2.40.0170.01047.78
8.2.30.0190.00947.62
8.2.20.0070.01847.20
8.2.10.0040.02247.54
8.2.00.0130.02047.10
8.1.280.0670.03379.75
8.1.270.0280.01651.54
8.1.260.0230.02049.87
8.1.250.0230.01351.39
8.1.240.0230.00651.66
8.1.230.0330.00348.54
8.1.220.0100.01647.29
8.1.210.0100.01647.16
8.1.200.0230.01046.85
8.1.190.0210.01446.73
8.1.180.0140.01146.85
8.1.170.0100.02048.02
8.1.160.0140.01051.40
8.1.150.0200.01348.32
8.1.140.0220.00646.71
8.1.130.0100.01747.11
8.1.120.0210.01046.84
8.1.110.0110.01446.86
8.1.100.0200.00746.73
8.1.90.0190.01046.82
8.1.80.0220.00646.79
8.1.70.0200.01046.73
8.1.60.0140.01146.86
8.1.50.0200.00746.78
8.1.40.0130.01946.91
8.1.30.0140.01446.85
8.1.20.0120.01246.97
8.1.10.0160.03280.99
8.1.00.0440.02781.02
8.0.300.0280.01780.71
8.0.290.0270.01780.00
8.0.280.0230.02081.72
8.0.270.0430.01380.54
8.0.260.0170.02880.68
8.0.250.0200.02080.14
8.0.240.0350.02380.18
8.0.230.0390.01380.27
8.0.220.0290.01980.16
8.0.210.0430.01080.34
8.0.200.0170.02780.27
8.0.190.0380.01780.31
8.0.180.0200.03680.32
8.0.170.0210.02480.18
8.0.160.0360.02380.25
8.0.150.0440.00780.23
8.0.140.0600.01380.21
8.0.130.0760.024136.89
8.0.120.0310.01480.28
8.0.110.0300.01680.20
8.0.100.0250.02180.22
8.0.90.0200.02080.25
8.0.80.0420.05880.14
8.0.70.0230.02780.23
8.0.60.0160.02980.27
8.0.50.0200.02080.10
8.0.30.0720.06480.67
8.0.20.0840.05280.47
8.0.10.0200.02780.40
8.0.00.0740.04980.04
7.4.330.0330.01776.84
7.4.320.0260.01379.81
7.4.300.0300.02379.76
7.4.290.0160.02679.73
7.4.280.0370.01779.87
7.4.270.0300.01679.95
7.4.260.0330.02079.94
7.4.250.0200.02679.90
7.4.240.0300.01779.82
7.4.230.0240.01779.92
7.4.220.0670.05879.91
7.4.210.0690.06279.67
7.4.200.0260.01679.83
7.4.160.0750.03979.79
7.4.150.0900.06079.95
7.4.140.0810.06279.90
7.4.130.0630.04879.83
7.4.120.0540.06279.94
7.4.110.0510.05779.83
7.4.100.0590.05980.02
7.4.90.0630.05379.73
7.4.80.0660.06379.92
7.4.70.0760.04979.97
7.4.60.0690.06279.84
7.4.50.0270.02379.77
7.4.40.0640.05179.59
7.4.30.0560.05379.84
7.4.00.0260.03378.42
7.3.330.0790.029135.99
7.3.320.0740.024135.97
7.3.310.0330.01379.26
7.3.300.0260.01679.15
7.3.290.0360.06679.38
7.3.280.0650.04479.28
7.3.270.1140.05579.61
7.3.260.0620.05279.12
7.3.250.0600.05479.42
7.3.240.0820.05979.37
7.3.230.0710.05279.18
7.3.210.0520.06179.11
7.3.200.0630.07379.21
7.3.190.0720.08279.43
7.3.180.0470.06078.99
7.3.170.0420.07679.48
7.3.160.0470.06079.52
7.2.330.0620.06279.64
7.2.320.0950.08779.57
7.2.310.0650.06979.34
7.2.300.0560.06679.70
7.2.290.0740.08479.64
7.2.60.5020.03078.70
7.2.00.4520.03381.37
7.1.200.2900.01577.61
7.1.101.6780.01779.32
7.1.70.3110.03778.90
7.1.60.0260.04079.45
7.1.50.0650.03678.80
7.1.00.0170.11084.38
7.0.200.3100.03378.33
7.0.140.0030.11083.92
7.0.60.0370.10383.59
7.0.50.0170.07381.32
7.0.40.0100.08019.96
7.0.30.0530.06020.03
7.0.20.0130.06320.15
7.0.10.0070.07720.23
7.0.00.0170.09020.10
5.6.280.0300.08355.07
5.6.210.0330.08354.70
5.6.200.0270.10052.31
5.6.190.0170.09754.55
5.6.180.3270.05054.68
5.6.170.0300.05354.54
5.6.160.0200.09354.52
5.6.150.0170.07752.32
5.6.140.0270.07352.36
5.6.130.0200.10752.28
5.6.120.0270.09355.32
5.6.110.0270.10055.16
5.6.100.0170.08355.33
5.6.90.0130.06755.15
5.6.80.0300.08354.57
5.5.350.0570.08356.04
5.5.340.0300.05753.61
5.5.330.0170.05355.81
5.5.320.0570.08355.82
5.5.310.0530.09355.76
5.5.300.0130.06753.59
5.5.290.0200.10353.64
5.5.280.0370.08056.49
5.5.270.0170.06756.41
5.5.260.0200.10756.47
5.5.250.0170.06756.31
5.5.240.0200.10055.68
5.4.450.0600.06757.06
5.4.440.0730.07757.29
5.4.430.0270.07357.39
5.4.420.0500.05057.27
5.4.410.0400.06357.27
5.4.400.0430.06057.18
5.4.390.0700.05756.82
5.4.380.0770.09055.95
5.4.370.0630.10355.99
5.4.360.0770.06755.99
5.4.350.0600.08055.98
5.4.340.0670.09355.95
5.4.320.0200.05449.72
5.4.310.0220.05249.72
5.4.300.0190.05649.73
5.4.290.0120.06149.70
5.4.280.0200.05148.95
5.4.270.0160.05448.95
5.4.260.0130.06048.95
5.4.250.0200.06448.95
5.4.240.0200.05148.95
5.4.230.0180.05548.93
5.4.220.0120.05948.91
5.4.210.0140.05648.93
5.4.200.0170.05548.94
5.4.190.0140.05848.94
5.4.180.0210.08248.93
5.4.170.0160.05248.92
5.4.160.0170.05448.93
5.4.150.0180.05348.93
5.4.140.0120.05748.62
5.4.130.0200.06348.59
5.4.120.0160.05346.72
5.4.110.0200.05146.71
5.4.100.0180.05446.70
5.4.90.0300.06846.71
5.4.80.0340.08146.71
5.4.70.0160.05346.69
5.4.60.0130.05546.69
5.4.50.0140.05546.71
5.4.40.0200.05046.69
5.4.30.0210.04846.71
5.4.20.0310.04946.70
5.4.10.0150.06146.71
5.4.00.0180.05146.20
5.3.290.0190.05952.15
5.3.280.0170.05849.46
5.3.270.0220.06649.46
5.3.260.0150.06249.46
5.3.250.0180.05349.45
5.3.240.0200.05149.45
5.3.230.0170.05649.45
5.3.220.0120.06249.43
5.3.210.0240.05149.43
5.3.200.0210.06849.41
5.3.190.0200.05349.42
5.3.180.0400.07849.40
5.3.170.0180.06149.41
5.3.160.0290.06849.43
5.3.150.0220.07449.42
5.3.140.0140.06149.41
5.3.130.0190.05749.41
5.3.120.0200.06549.42
5.3.110.0170.05749.41
5.3.100.0140.05848.91
5.3.90.0170.06349.50
5.3.80.0190.05448.27
5.3.70.0160.05748.28
5.3.60.0210.05548.26
5.3.50.0180.06248.21
5.3.40.0190.05348.21
5.3.30.0200.04948.15
5.3.20.0200.05647.96
5.3.10.0250.05247.89
5.3.00.0190.05849.09
5.2.170.0050.0409.18
5.2.160.0060.0279.18
5.2.150.0030.0319.18
5.2.140.0060.0409.17
5.2.130.0060.0369.14
5.2.120.0060.0339.14
5.2.110.0070.0329.14
5.2.100.0050.0279.14
5.2.90.0050.0289.14
5.2.80.0070.0289.14
5.2.70.0060.0299.14
5.2.60.0060.0279.08
5.2.50.0050.0299.05
5.2.40.0080.0259.04
5.2.30.0060.0289.01
5.2.20.0040.0299.00
5.2.10.0020.0308.93
5.2.00.0060.0278.78
5.1.60.0050.0238.07
5.1.50.0030.0258.07
5.1.40.0020.0268.05
5.1.30.0040.0258.40
5.1.20.0030.0278.41
5.1.10.0060.0248.14
5.1.00.0040.0258.14
5.0.50.0030.0306.62
5.0.40.0050.0256.48
5.0.30.0030.0366.30
5.0.20.0040.0306.26
5.0.10.0040.0356.24
5.0.00.0040.0296.23
4.4.90.0020.0294.78
4.4.80.0030.0184.75
4.4.70.0020.0274.75
4.4.60.0040.0244.76
4.4.50.0030.0254.77
4.4.40.0030.0344.71
4.4.30.0030.0154.76
4.4.20.0040.0224.84
4.4.10.0030.0224.85
4.4.00.0050.0284.76
4.3.110.0030.0214.67
4.3.100.0030.0144.66
4.3.90.0030.0184.63
4.3.80.0020.0324.58
4.3.70.0020.0154.63
4.3.60.0040.0134.63
4.3.50.0020.0164.63
4.3.40.0030.0234.54
4.3.30.0010.0173.28
4.3.20.0030.0153.26
4.3.10.0020.0153.22
4.3.00.0100.01713.25

preferences:
39.76 ms | 401 KiB | 5 Q