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) { echo $memoFib($i) . PHP_EOL; }

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.0600.02680.23
8.3.50.0440.04081.87
8.3.40.0420.01048.29
8.3.30.0290.01948.71
8.3.20.0180.01149.83
8.3.10.0120.00951.58
8.3.00.0250.00347.38
8.2.180.0750.03180.13
8.2.170.0290.01948.38
8.2.160.0380.02750.02
8.2.150.0170.01048.60
8.2.140.0190.00648.96
8.2.130.0220.00650.03
8.2.120.0160.00348.73
8.2.110.0130.00750.09
8.2.100.0310.01047.59
8.2.90.0170.01047.67
8.2.80.0070.02047.43
8.2.70.0200.00747.53
8.2.60.0060.01947.72
8.2.50.0200.00747.66
8.2.40.0200.00749.69
8.2.30.0160.01648.75
8.2.20.0130.01347.13
8.2.10.0160.00947.63
8.2.00.0070.01747.27
8.1.280.0700.02379.63
8.1.270.0200.01051.39
8.1.260.0250.00449.60
8.1.250.0210.00651.54
8.1.240.0140.02151.69
8.1.230.0310.00948.60
8.1.220.0070.02147.27
8.1.210.0100.01647.01
8.1.200.0210.00946.85
8.1.190.0100.01646.73
8.1.180.0100.01747.01
8.1.170.0200.00748.07
8.1.160.0170.01448.26
8.1.150.0160.01049.46
8.1.140.0150.00946.89
8.1.130.0030.01947.20
8.1.120.0210.00346.72
8.1.110.0100.01646.71
8.1.100.0110.01546.86
8.1.90.0180.01546.88
8.1.80.0130.01346.88
8.1.70.0130.01346.71
8.1.60.0070.02046.95
8.1.50.0120.01246.87
8.1.40.0270.00346.78
8.1.30.0150.00946.96
8.1.20.0060.01946.95
8.1.10.0170.02481.10
8.1.00.0300.02480.87
8.0.300.0170.02683.14
8.0.290.0320.01680.25
8.0.280.0270.02081.74
8.0.270.0260.02080.64
8.0.260.0170.02480.70
8.0.250.0190.02280.31
8.0.240.0220.02280.34
8.0.230.0230.02080.27
8.0.220.0250.01680.14
8.0.210.0300.01380.16
8.0.200.0230.02080.38
8.0.190.0330.02080.36
8.0.180.0280.02880.33
8.0.170.0170.02780.28
8.0.160.0230.02280.38
8.0.150.0290.02380.11
8.0.140.0470.01080.16
8.0.130.0890.028136.76
8.0.120.0230.02380.07
8.0.110.0130.03280.12
8.0.100.0180.02580.16
8.0.90.0210.02180.23
8.0.80.0830.04280.25
8.0.70.0200.02380.09
8.0.60.0200.02480.27
8.0.50.0200.02080.15
8.0.30.0640.05980.36
8.0.20.0660.05780.54
8.0.10.0200.02080.44
8.0.00.0800.04580.08
7.4.330.0200.01776.77
7.4.320.0270.01379.80
7.4.300.0230.01979.84
7.4.290.0130.03079.92
7.4.280.0220.02579.80
7.4.270.0210.02479.82
7.4.260.0270.02079.87
7.4.250.0250.02579.84
7.4.240.0270.02079.86
7.4.230.0260.01679.84
7.4.220.0810.05579.93
7.4.210.0500.04379.89
7.4.200.0340.01079.79
7.4.160.0650.03979.95
7.4.150.0880.03479.87
7.4.140.0610.05579.93
7.4.130.0810.03679.80
7.4.120.0660.04579.77
7.4.110.0730.03879.68
7.4.100.0620.07479.87
7.4.90.0670.04379.85
7.4.80.0770.05279.96
7.4.70.0710.04879.74
7.4.60.0820.03979.73
7.4.50.0120.01679.77
7.4.40.0560.05679.82
7.4.30.0920.06679.81
7.4.00.0420.03978.23
7.3.330.0410.044135.87
7.3.320.0470.027136.11
7.3.310.0200.02479.31
7.3.300.0270.01779.09
7.3.290.0530.04379.19
7.3.280.0560.04879.19
7.3.270.0750.05279.28
7.3.260.0660.05079.45
7.3.250.0770.06179.14
7.3.240.0660.03979.44
7.3.230.0770.03779.11
7.3.210.0650.06579.19
7.3.200.0670.04779.26
7.3.190.0650.04479.05
7.3.180.0640.04779.25
7.3.170.0740.03479.35
7.3.160.0550.05279.17
7.3.120.0460.03377.69
7.3.110.0370.03377.60
7.3.100.0390.03377.77
7.3.90.0280.03877.57
7.3.80.0370.03277.69
7.3.70.0340.02977.83
7.3.60.0360.03677.68
7.3.50.0360.02677.73
7.3.40.0250.03577.62
7.3.30.0450.02477.59
7.3.20.0520.02478.65
7.3.10.0620.03578.44
7.3.00.0320.03478.71
7.2.330.0690.05679.25
7.2.320.0660.06079.45
7.2.310.0630.05979.39
7.2.300.0580.06579.60
7.2.290.0760.08979.62
7.2.250.0360.03977.87
7.2.240.0460.04277.83
7.2.230.0300.04277.79
7.2.220.0330.04378.05
7.2.210.0320.03977.93
7.2.200.0400.03477.73
7.2.190.0340.03277.91
7.2.180.0370.03277.79
7.2.170.0280.03977.73
7.2.160.0230.04377.73
7.2.150.0330.03078.77
7.2.140.0240.02478.64
7.2.130.0320.03978.57
7.2.120.0470.02579.04
7.2.110.1040.02178.47
7.2.100.0380.03578.82
7.2.90.0410.03378.87
7.2.80.0450.02678.73
7.2.70.0330.03378.99
7.2.60.1390.02879.02
7.2.50.0400.05278.89
7.2.40.0170.03779.00
7.2.30.0940.03878.81
7.2.20.0460.02178.96
7.2.10.0530.04978.88
7.2.00.0490.03680.08
7.1.330.0310.04877.78
7.1.320.0310.04677.72
7.1.310.0290.05077.71
7.1.300.0310.04777.66
7.1.290.0410.04177.84
7.1.280.0640.04377.50
7.1.270.0730.04177.77
7.1.260.0420.04377.69
7.1.250.0490.05277.81
7.1.200.1270.02177.75
7.1.100.2100.02080.06
7.1.70.1580.01079.16
7.1.60.0100.02879.09
7.1.50.0310.05178.80
7.1.00.0130.10784.42
7.0.200.4390.02778.19
7.0.140.0100.10783.92
7.0.60.0270.11383.44
7.0.50.0400.05081.45
7.0.40.0170.05320.27
7.0.30.0130.11720.08
7.0.20.0300.10020.17
7.0.10.0200.04720.12
7.0.00.0200.08720.20
5.6.280.0230.09055.08
5.6.210.0200.10754.95
5.6.200.0100.08052.35
5.6.190.0270.09754.63
5.6.180.0300.04754.52
5.6.170.0470.08354.57
5.6.160.0300.09054.58
5.6.150.0200.06752.35
5.6.140.0130.10352.42
5.6.130.0200.10352.31
5.6.120.0200.05755.18
5.6.110.0230.04355.18
5.6.100.0300.09355.32
5.6.90.0170.08055.15
5.6.80.0230.09054.60
5.5.350.3100.04756.05
5.5.340.0230.09053.55
5.5.330.0200.09355.75
5.5.320.0300.07355.83
5.5.310.0330.05755.75
5.5.300.0200.11053.57
5.5.290.0230.06353.56
5.5.280.0170.08356.43
5.5.270.0170.07056.48
5.5.260.0270.08056.45
5.5.250.0330.09356.27
5.5.240.0430.10055.78
5.4.450.0530.09057.32
5.4.440.0570.08757.14
5.4.430.0400.06757.14
5.4.420.0300.08757.27
5.4.410.0330.05357.02
5.4.400.0330.06356.70
5.4.390.0430.08356.82
5.4.380.0400.05356.71
5.4.370.0400.09757.16
5.4.360.0470.09356.69
5.4.350.0370.04757.07
5.4.340.0370.05756.71
5.4.320.0330.09056.92
5.4.310.0230.07056.73
5.4.300.0230.05356.93
5.4.290.0400.05756.96
5.4.280.0270.08756.86
5.4.270.0400.08756.93
5.4.260.0270.08056.82
5.4.250.0300.05056.73
5.4.240.0400.07057.16
5.4.230.0230.06056.79
5.4.220.0400.07356.91
5.4.210.0330.07056.84
5.4.200.0370.09057.08
5.4.190.0400.04056.96
5.4.180.0300.09356.85
5.4.170.0230.06056.84
5.4.160.0400.08356.89
5.4.150.0300.05357.16
5.4.140.0330.09053.71
5.4.130.0470.07052.85
5.4.120.0400.07753.02
5.4.110.0500.07354.19
5.4.100.0230.05354.34
5.4.90.0370.05754.26
5.4.80.0300.05354.46
5.4.70.0300.09054.18
5.4.60.0370.08754.23
5.4.50.0370.07054.08
5.4.40.0200.05754.16
5.4.30.0370.06754.34
5.4.20.0600.07354.18
5.4.10.0400.06754.34
5.4.00.0470.05052.38
5.3.290.0330.07753.94
5.3.280.0400.09351.13
5.3.270.0430.08051.47
5.3.260.0270.10351.32
5.3.250.0270.06351.14
5.3.240.0400.07351.15
5.3.230.0530.06751.24
5.3.220.0400.09051.42
5.3.210.0470.08351.29
5.3.200.0470.08351.23
5.3.190.0530.08351.18
5.3.180.0270.06051.12
5.3.170.0500.06751.30
5.3.160.0400.06051.41
5.3.150.0400.09351.20
5.3.140.0330.06351.30
5.3.130.0370.09351.19
5.3.120.0400.05051.30
5.3.110.0600.07751.25
5.3.100.0330.05050.82
5.3.90.0370.09051.36
5.3.80.0370.04749.91
5.3.70.0370.07050.08
5.3.60.0330.06050.07
5.3.50.0300.04749.91
5.3.40.0230.05350.02
5.3.30.0330.05349.81
5.3.20.0530.06349.69
5.3.10.0230.07049.72
5.3.00.0600.06350.85
5.2.170.0200.05711.90
5.2.160.0170.05711.90
5.2.150.0170.04711.90
5.2.140.0200.05711.90
5.2.130.0100.03011.90
5.2.120.0200.03711.90
5.2.110.0170.04711.90
5.2.100.0230.04711.90
5.2.90.0300.05311.90
5.2.80.0230.05011.90
5.2.70.0200.05711.90
5.2.60.0170.05711.90
5.2.50.0230.05711.90
5.2.40.0230.03311.90
5.2.30.0200.03711.90
5.2.20.0200.03711.90
5.2.10.0230.05311.90
5.2.00.0200.03311.90
5.1.60.0130.04311.90
5.1.50.0170.04311.90
5.1.40.0230.04011.90
5.1.30.0130.04311.90
5.1.20.0100.03011.90
5.1.10.0130.02311.90
5.1.00.0170.04011.90
5.0.50.0070.02311.90
5.0.40.0070.03011.90
5.0.30.0100.06011.90
5.0.20.0070.02311.90
5.0.10.0070.02011.90
5.0.00.0100.04311.90
4.4.90.0030.01711.90
4.4.80.0100.03311.90
4.4.70.0070.01311.90
4.4.60.0070.01311.90
4.4.50.0100.01311.90
4.4.40.0070.05011.90
4.4.30.0100.02311.90
4.4.20.0100.03311.90
4.4.10.0130.02711.90
4.4.00.0130.04311.90
4.3.110.0130.03311.90
4.3.100.0130.01711.90
4.3.90.0130.01311.90
4.3.80.0070.03311.90
4.3.70.0100.03311.90
4.3.60.0070.02711.90
4.3.50.0000.02711.90
4.3.40.0030.04711.90
4.3.30.0030.01711.90
4.3.20.0100.01011.90
4.3.10.0030.02311.90
4.3.00.0030.02011.90

preferences:
59.03 ms | 400 KiB | 5 Q