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.0800.03380.50
8.3.50.0770.02881.07
8.3.40.0350.01648.64
8.3.30.0270.02048.86
8.3.20.0250.00349.96
8.3.10.0100.01351.56
8.3.00.0160.01347.11
8.2.180.0600.02780.11
8.2.170.0450.01048.45
8.2.160.0260.01950.10
8.2.150.0230.00348.64
8.2.140.0200.00348.79
8.2.130.0180.01149.91
8.2.120.0110.00448.70
8.2.110.0140.00749.02
8.2.100.0330.00747.28
8.2.90.0120.01947.78
8.2.80.0180.01147.79
8.2.70.0140.01746.88
8.2.60.0150.01147.13
8.2.50.0120.01247.13
8.2.40.0120.00947.58
8.2.30.0290.01047.63
8.2.20.0150.01147.25
8.2.10.0130.01347.68
8.2.00.0190.00647.20
8.1.280.0570.03079.63
8.1.270.0150.00951.43
8.1.260.0170.01049.88
8.1.250.0200.00751.32
8.1.240.0130.01050.23
8.1.230.0190.01950.42
8.1.220.0200.00347.16
8.1.210.0130.01348.13
8.1.200.0090.01646.73
8.1.190.0110.01846.85
8.1.180.0230.00746.86
8.1.170.0190.00646.85
8.1.160.0170.00751.38
8.1.150.0100.01648.13
8.1.140.0030.02046.78
8.1.130.0030.01947.13
8.1.120.0100.01346.75
8.1.110.0160.00946.71
8.1.100.0060.01946.70
8.1.90.0270.00746.72
8.1.80.0070.01746.73
8.1.70.0070.02146.71
8.1.60.0130.01346.96
8.1.50.0220.00646.88
8.1.40.0190.01046.77
8.1.30.0270.00046.87
8.1.20.0060.01846.86
8.1.10.0210.02181.07
8.1.00.0240.02081.07
8.0.300.0260.02083.40
8.0.290.0240.02180.25
8.0.280.0260.01681.70
8.0.270.0270.01780.70
8.0.260.0200.02080.55
8.0.250.0250.01680.41
8.0.240.0170.02780.32
8.0.230.0310.01080.28
8.0.220.0290.01380.16
8.0.210.0280.01480.18
8.0.200.0220.01980.21
8.0.190.0340.01780.22
8.0.180.0320.01380.30
8.0.170.0130.02980.32
8.0.160.0240.02180.21
8.0.150.0300.01480.16
8.0.140.0240.02080.13
8.0.130.0500.023136.79
8.0.120.0370.01080.21
8.0.110.0200.02480.27
8.0.100.0230.02080.11
8.0.90.0130.02780.23
8.0.80.0780.06880.27
8.0.70.0310.01080.17
8.0.60.0190.02380.16
8.0.50.0200.02080.24
8.0.30.0700.06680.47
8.0.20.0720.05780.36
8.0.10.0300.01380.27
8.0.00.0580.06180.19
7.4.330.0210.01476.77
7.4.320.0210.01779.72
7.4.300.0260.01679.89
7.4.290.0180.02579.80
7.4.280.0190.02579.88
7.4.270.0370.00779.79
7.4.260.0200.02379.77
7.4.250.0280.01879.75
7.4.240.0260.02079.80
7.4.230.0230.01979.99
7.4.220.1000.04679.82
7.4.210.0410.05179.85
7.4.200.0200.02479.72
7.4.160.0600.04480.00
7.4.150.0690.05979.72
7.4.140.0620.06179.83
7.4.130.0830.04779.69
7.4.120.0590.05479.91
7.4.110.0420.07679.85
7.4.100.0650.04279.77
7.4.90.0520.06279.79
7.4.80.0630.05379.75
7.4.70.0730.03779.77
7.4.60.0660.04679.85
7.4.50.0170.01079.84
7.4.40.0530.05679.85
7.4.30.0690.03679.83
7.4.00.0390.03778.28
7.3.330.0360.040135.92
7.3.320.0510.026136.02
7.3.310.0160.02679.24
7.3.300.0230.01779.04
7.3.290.0630.08179.26
7.3.280.0600.04879.15
7.3.270.0640.06579.54
7.3.260.0680.05279.02
7.3.250.0540.05879.32
7.3.240.0530.05279.15
7.3.230.0850.03979.41
7.3.210.0560.05679.16
7.3.200.0550.05979.40
7.3.190.0660.08279.30
7.3.180.0490.06379.22
7.3.170.0610.05279.42
7.3.160.0610.04479.28
7.3.120.0450.04277.85
7.3.110.0390.03977.70
7.3.100.0310.03877.57
7.3.90.0490.02377.70
7.3.80.0300.03777.57
7.3.70.0400.02877.59
7.3.60.0310.04477.66
7.3.50.0360.03177.52
7.3.40.0250.03477.64
7.3.30.0290.03477.61
7.3.20.0270.02578.55
7.3.10.0340.02578.49
7.3.00.0320.02578.53
7.2.330.0670.06479.57
7.2.320.0390.09179.47
7.2.310.0500.07679.63
7.2.300.0690.07579.42
7.2.290.0930.02679.56
7.2.250.0490.03677.90
7.2.240.0460.04077.73
7.2.230.0250.04577.94
7.2.220.0260.04677.64
7.2.210.0430.02677.92
7.2.200.0310.04577.79
7.2.190.0360.04477.72
7.2.180.0280.04578.01
7.2.170.0390.03777.84
7.2.160.0390.04277.82
7.2.150.0280.01378.99
7.2.140.0460.02378.77
7.2.130.0470.02278.88
7.2.120.0620.04678.86
7.2.110.0170.04678.91
7.2.100.0200.03878.78
7.2.90.0230.04078.82
7.2.80.0460.03778.94
7.2.70.0550.02978.98
7.2.60.1080.02978.66
7.2.50.0340.03778.89
7.2.40.0420.03678.79
7.2.30.0360.03378.99
7.2.20.0340.04178.98
7.2.10.0340.03478.70
7.2.00.0780.03879.57
7.1.330.0490.04677.85
7.1.320.0270.04577.66
7.1.310.0300.05077.75
7.1.300.0310.04177.75
7.1.290.0280.04877.58
7.1.280.0290.04277.70
7.1.270.0150.05077.57
7.1.260.0220.05877.83
7.1.250.0560.05277.82
7.1.200.0940.02677.68
7.1.100.0130.04479.75
7.1.70.1310.02478.71
7.1.60.0230.04079.02
7.1.50.0540.03778.53
7.1.00.0130.11084.35
7.0.200.5330.02678.13
7.0.140.0100.11083.94
7.0.100.0700.09783.52
7.0.90.1530.10383.50
7.0.80.3200.06783.41
7.0.70.1370.09383.44
7.0.60.1230.09783.48
7.0.50.0900.05083.82
7.0.40.0170.10720.08
7.0.30.0100.10320.10
7.0.20.0100.11320.11
7.0.10.0230.10020.16
7.0.00.0230.07720.17
5.6.280.0230.09055.32
5.6.250.0230.10354.76
5.6.240.0070.07354.80
5.6.230.0200.08754.69
5.6.220.0230.08754.90
5.6.210.0130.10754.81
5.6.200.0300.10055.20
5.6.190.0200.10055.21
5.6.180.0270.09755.13
5.6.170.0200.10355.20
5.6.160.0300.09355.16
5.6.150.0230.09355.25
5.6.140.0130.10755.20
5.6.130.0200.10755.23
5.6.120.0300.06755.30
5.6.110.0200.10755.27
5.6.100.0200.08755.28
5.6.90.0170.10355.31
5.6.80.0370.06054.65
5.6.70.0200.10054.49
5.6.60.0300.08754.52
5.6.50.0170.07354.64
5.6.40.0200.10054.58
5.6.30.0130.10054.54
5.6.20.0230.08754.50
5.6.10.0270.06754.59
5.6.00.0300.10754.55
5.5.380.0130.10756.14
5.5.370.0100.06356.17
5.5.360.0270.09356.00
5.5.350.0230.06056.04
5.5.340.0200.11056.55
5.5.330.0170.06756.41
5.5.320.0130.12356.36
5.5.310.0130.10056.51
5.5.300.0170.09056.47
5.5.290.0300.08056.53
5.5.280.0330.08756.49
5.5.270.0130.10356.44
5.5.260.0270.07756.25
5.5.250.0170.11056.20
5.5.240.0230.09755.88
5.5.230.0270.08755.72
5.5.220.0230.08755.75
5.5.210.0230.11355.92
5.5.200.0330.09055.90
5.5.190.0300.07755.79
5.5.180.0270.10755.83
5.5.160.0300.08055.77
5.5.150.0270.06055.69
5.5.140.0100.11755.86
5.5.130.0230.10755.89
5.5.120.0130.12355.61
5.5.110.0100.07755.73
5.5.100.0300.10055.68
5.5.90.0300.10055.63
5.5.80.0170.06355.67
5.5.70.0130.07055.15
5.5.60.0200.08355.16
5.5.50.0100.12755.73
5.5.40.0200.08755.70
5.5.30.0270.11355.69
5.5.20.0270.08755.76
5.5.10.0130.09755.70
5.5.00.0270.09755.61
5.4.450.0370.08057.30
5.4.440.0300.09357.40
5.4.430.0170.10357.21
5.4.420.0330.07057.19
5.4.410.0200.06757.12
5.4.400.0300.09056.88
5.4.390.0200.10756.87
5.4.380.0170.10756.89
5.4.370.0200.10356.86
5.4.360.0230.08356.99
5.4.350.0300.05756.95
5.4.340.0170.10056.77
5.4.320.0170.08756.72
5.4.310.0230.09356.82
5.4.300.0200.09056.72
5.4.290.0230.08756.96
5.4.280.0300.09356.80
5.4.270.0170.09056.87
5.4.260.0230.07356.95
5.4.250.0300.09356.71
5.4.240.0130.10056.90
5.4.230.0170.10056.96
5.4.220.0270.09056.93
5.4.210.0270.09056.95
5.4.200.0230.07357.03
5.4.190.0200.09757.08
5.4.180.0170.08356.89
5.4.170.0230.09057.04
5.4.160.0170.06756.88
5.4.150.0230.09056.93
5.4.140.0270.08753.45
5.4.130.0170.06752.94
5.4.120.0100.09052.86
5.4.110.0230.04754.30
5.4.100.0230.09354.36
5.4.90.0300.09054.21
5.4.80.0070.06354.25
5.4.70.0200.07754.32
5.4.60.0170.09354.17
5.4.50.0100.10354.35
5.4.40.0230.09054.20
5.4.30.0130.10354.36
5.4.20.0400.08054.21
5.4.10.0170.05054.34
5.4.00.0130.05052.41
5.3.290.0300.09753.94
5.3.280.0170.08351.22
5.3.270.0100.11051.20
5.3.260.0100.07051.38
5.3.250.0200.09751.33
5.3.240.0270.09751.18
5.3.230.0200.09351.32
5.3.220.0030.10751.27
5.3.210.0070.11351.16
5.3.200.0130.10051.32
5.3.190.0230.09051.29
5.3.180.0270.08751.27
5.3.170.0300.08051.28
5.3.160.0270.08351.12
5.3.150.0330.10351.13
5.3.140.0130.09751.23
5.3.130.0200.09751.25
5.3.120.0170.08751.23
5.3.110.0270.07051.29
5.3.100.0170.11050.66
5.3.90.0200.06751.26
5.3.80.0230.07349.94
5.3.70.0300.08750.05
5.3.60.0270.09349.99
5.3.50.0330.09049.92
5.3.40.0200.09349.94
5.3.30.0300.09349.99
5.3.20.0070.09749.78
5.3.10.0070.06349.64
5.3.00.0100.10050.77
5.2.170.0070.06311.05
5.2.160.0070.06011.05
5.2.150.0030.06711.05
5.2.140.0030.06011.20
5.2.130.0070.05711.09
5.2.120.0070.06011.05
5.2.110.0030.06011.09
5.2.100.0130.03011.05
5.2.90.0030.06311.07
5.2.80.0000.07011.05
5.2.70.0100.05711.05
5.2.60.0100.05311.05
5.2.50.0030.06311.05
5.2.40.0130.05011.05
5.2.30.0030.06011.05
5.2.20.0070.03311.05
5.2.10.0070.05011.05
5.2.00.0100.05711.05
5.1.60.0000.06011.05
5.1.50.0030.05711.05
5.1.40.0000.05311.05
5.1.30.0030.06311.05
5.1.20.0070.05711.05
5.1.10.0030.05711.05
5.1.00.0000.06011.05
5.0.50.0070.05011.05
5.0.40.0100.02311.05
5.0.30.0000.06011.05
5.0.20.0100.03711.05
5.0.10.0030.03011.05
5.0.00.0030.05311.05
4.4.90.0000.02311.05
4.4.80.0000.04011.05
4.4.70.0000.04011.05
4.4.60.0070.03311.05
4.4.50.0030.01711.05
4.4.40.0000.05711.05
4.4.30.0030.03711.05
4.4.20.0000.04011.05
4.4.10.0100.03011.05
4.4.00.0000.05011.05
4.3.110.0030.02711.05
4.3.100.0000.03311.05
4.3.90.0030.03311.05
4.3.80.0000.02711.05
4.3.70.0000.03711.05
4.3.60.0030.03311.05
4.3.50.0070.02711.05
4.3.40.0030.05011.05
4.3.30.0000.03711.05
4.3.20.0070.03311.05
4.3.10.0030.02011.05
4.3.00.0000.02011.05

preferences:
44.81 ms | 401 KiB | 5 Q