3v4l.org

run code in 300+ PHP versions simultaneously
<?php $foo = array(); function slow($foo) { // Slower if (isset($foo) && is_array($foo)) { return true; } } function fast($foo) { // Faster if (isset($foo)) { if (is_array($foo)) { return true; } } } function benchmark($callback, $times) { echo "Testing $callback - Valid\n"; $s = microtime(true); for ($i = 0; $i < $times; $i++) { $callback(array(1, 2, 3)); } $e = microtime(true); echo "Completed in " . ($e - $s) . " Seconds\n"; echo "Testing $callback - Invalid\n"; $s = microtime(true); for ($i = 0; $i < $times; $i++) { $callback("string"); } $e = microtime(true); echo "Completed in " . ($e - $s) . " Seconds\n"; echo "Testing $callback - null\n"; $s = microtime(true); for ($i = 0; $i < $times; $i++) { $callback(null); } $e = microtime(true); echo "Completed in " . ($e - $s) . " Seconds\n"; } benchmark("slow", 1000); benchmark("fast", 1000);

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.3.10.0170.00416.27
7.3.00.0190.00016.13
7.2.130.0140.01416.16
7.2.120.0210.00616.42
7.2.110.0200.00716.61
7.2.100.0160.00816.46
7.2.90.0220.00416.35
7.2.80.0280.00716.75
7.2.70.0140.01416.54
7.2.60.0100.01416.51
7.2.50.0150.01116.55
7.2.40.0100.01016.32
7.2.30.0100.00616.10
7.2.20.0140.00716.27
7.2.10.0100.00716.34
7.2.00.0060.01118.02
7.1.250.0220.00015.23
7.1.70.0000.01016.97
7.1.60.0040.02219.17
7.1.50.0110.01416.96
7.1.00.0030.07322.42
7.0.200.0060.00916.49
7.0.140.0000.07321.96
7.0.60.0030.06320.03
7.0.50.0170.07717.88
7.0.40.0100.08720.09
7.0.30.0230.04320.19
7.0.20.0300.07720.30
7.0.10.0070.04720.10
7.0.00.0100.03720.05
5.6.280.0030.07721.13
5.6.210.0030.09320.68
5.6.200.0030.04318.24
5.6.190.0070.06720.77
5.6.180.0270.06020.48
5.6.170.0230.05720.47
5.6.160.0070.07720.50
5.6.150.0070.08718.27
5.6.140.0030.04018.22
5.6.130.0100.08318.17
5.6.120.0030.04721.01
5.6.110.0070.07021.00
5.6.100.0070.08721.14
5.6.90.0100.08321.09
5.6.80.0170.07320.39
5.5.350.0200.08720.33
5.5.340.0030.04018.08
5.5.330.0070.05020.25
5.5.320.0530.06320.27
5.5.310.0370.07320.20
5.5.300.0000.07717.99
5.5.290.0030.09317.98
5.5.280.0130.07720.81
5.5.270.0070.05720.67
5.5.260.0130.07720.78
5.5.250.0100.06720.59
5.5.240.0130.06720.27
5.4.450.0500.06719.50
5.4.440.0430.05319.20
5.4.430.0370.04319.54
5.4.420.0370.04019.27
5.4.410.0300.04019.42
5.4.400.0270.04319.22
5.4.390.0300.04019.21
5.4.380.0330.03719.13
5.4.370.0300.04019.09
5.4.360.0330.03719.06
5.4.350.0330.04019.00
5.4.340.0300.04318.87
5.4.320.0530.06319.22
5.4.310.0630.05318.95
5.4.300.0530.06019.21
5.4.290.0370.04318.94
5.4.280.0570.03718.87
5.4.270.0500.03018.97
5.4.260.0570.06319.24
5.4.250.0470.05019.04
5.4.240.0430.07019.07
5.4.230.0470.04019.05
5.4.220.0330.04719.31
5.4.210.0470.03319.07
5.4.200.0400.03718.97
5.4.190.0470.07319.12
5.4.180.0530.06719.07
5.4.170.0600.03719.23
5.4.160.0500.07019.08
5.4.150.0570.06318.83
5.4.140.0530.06316.43
5.4.130.0370.04716.42
5.4.120.0470.03016.48
5.4.110.0330.05316.23
5.4.100.0470.04716.59
5.4.90.0470.06316.63
5.4.80.0430.03316.49
5.4.70.0370.04016.33
5.4.60.0370.04716.33
5.4.50.0430.05716.53
5.4.40.0630.05716.43
5.4.30.0600.06016.53
5.4.20.0470.04016.32
5.4.10.0430.04316.43
5.4.00.0470.06315.81
5.3.290.0500.03014.60
5.3.280.0470.06314.61
5.3.270.0530.06014.61
5.3.260.0530.06314.60
5.3.250.0400.04714.54
5.3.240.0600.05714.58
5.3.230.0470.07014.76
5.3.220.0500.06714.66
5.3.210.0470.06014.58
5.3.200.0530.03014.69
5.3.190.0600.05314.66
5.3.180.0530.06014.54
5.3.170.0400.06014.47
5.3.160.0330.04314.58
5.3.150.0570.06014.55
5.3.140.0500.07014.61
5.3.130.0500.04714.64
5.3.120.0430.04314.58
5.3.110.0430.03714.61
5.3.100.0470.05013.96
5.3.90.0400.03714.11
5.3.80.0370.05013.95
5.3.70.0430.07314.08
5.3.60.0630.03313.93
5.3.50.0400.05014.12
5.3.40.0470.06714.19
5.3.30.0530.02313.79
5.3.20.0470.04013.62
5.3.10.0570.05013.82
5.3.00.0400.03313.57
5.2.170.0430.05312.37
5.2.160.0430.05012.37
5.2.150.0370.04012.37
5.2.140.0400.06012.37
5.2.130.0430.05712.37
5.2.120.0400.05712.37
5.2.110.0400.05312.37
5.2.100.0470.05312.37
5.2.90.0470.05012.37
5.2.80.0370.03012.37
5.2.70.0430.05712.37
5.2.60.0470.04312.37
5.2.50.0500.05312.37
5.2.40.0370.05312.37
5.2.30.0230.03712.37
5.2.20.0270.03312.37
5.2.10.0370.05312.37
5.2.00.0370.04712.37
5.1.60.0330.03712.37
5.1.50.0370.03012.37
5.1.40.0330.05012.37
5.1.30.0300.04312.37
5.1.20.0300.05312.37
5.1.10.0400.05012.37
5.1.00.0400.04712.37
5.0.50.0200.02712.37
5.0.40.0230.02712.37
5.0.30.0200.06012.37
5.0.20.0230.03312.37
5.0.10.0200.04312.37
5.0.00.0230.06012.37
4.4.90.0170.04312.37
4.4.80.0170.04012.37
4.4.70.0130.02012.37
4.4.60.0200.04012.37
4.4.50.0200.03712.37
4.4.40.0170.04012.37
4.4.30.0200.03312.37
4.4.20.0100.02312.37
4.4.10.0230.04012.37
4.4.00.0230.05312.37
4.3.110.0200.02712.37
4.3.100.0200.03312.37
4.3.90.0130.03312.37
4.3.80.0170.05312.37
4.3.70.0200.02012.37
4.3.60.0230.02712.37
4.3.50.0200.03312.37
4.3.40.0170.05312.37
4.3.30.0070.03712.37
4.3.20.0070.02712.37
4.3.10.0100.01712.37
4.3.00.0100.03312.37

preferences:
32.93 ms | 401 KiB | 5 Q