3v4l.org

run code in 500+ PHP versions simultaneously
<?php class LargeObject { protected $array; public function __construct() { $this->array = array_fill(0, 2000, 17); } public function getItemProcessor(): Closure { // Try with and without 'static' here return function () { // do some processing unrelated to $this }; } } $start = microtime(true); $processors = []; for ($i = 0; $i < 2000; $i++) { $lo = new LargeObject(); $processors[] = $lo->getItemProcessor(); } $memory = memory_get_usage() >> 20; $time = (microtime(true) - $start) * 1000; printf("This took %dms and %dMB of memory\n", $time, $memory);

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.5.60.0580.01473.18
8.5.50.0560.01972.74
8.5.40.0410.01672.98
8.5.30.0400.01172.73
8.5.20.0350.01673.07
8.5.10.0340.01473.10
8.5.00.0820.01972.74
8.4.210.0380.00556.33
8.4.190.0360.01156.26
8.4.180.0330.01056.38
8.4.170.0260.01256.49
8.4.160.0220.01456.64
8.4.150.0260.01356.33
8.4.140.0770.02574.13
8.4.130.0710.01874.12
8.4.120.0580.01874.37
8.4.110.0590.01774.22
8.4.100.0540.01374.27
8.4.90.0410.01374.29
8.4.80.0580.01774.30
8.4.70.0600.01674.31
8.4.60.0600.01674.32
8.4.50.0680.01674.12
8.4.40.0570.01774.06
8.4.30.0630.01874.12
8.4.20.0560.01574.10
8.4.10.0470.01475.58
8.3.310.0340.01158.86
8.3.300.0350.01358.38
8.3.290.0300.02058.61
8.3.280.0320.01458.42
8.3.270.0670.01273.02
8.3.260.0460.01473.08
8.3.250.0520.01573.03
8.3.240.0580.01772.92
8.3.230.0630.01772.96
8.3.220.0420.01273.19
8.3.210.0470.01673.04
8.3.200.0530.01673.03
8.3.190.0520.01773.04
8.3.180.0500.01372.98
8.3.170.0510.01473.17
8.3.160.0550.01273.14
8.3.150.0520.01473.09
8.3.140.0560.01674.08
8.3.130.0420.01473.96
8.3.120.0420.01374.08
8.3.110.0430.01374.09
8.3.100.0450.01274.02
8.3.90.0460.01273.90
8.3.80.0450.01373.92
8.3.70.0480.01473.96
8.3.60.0460.01473.94
8.3.50.0440.01573.97
8.3.40.0280.00944.52
8.3.30.0290.01144.62
8.3.20.0300.00944.76
8.3.10.0310.01044.97
8.3.00.0260.01044.62
8.2.310.0390.01058.92
8.2.300.0280.01159.84
8.2.290.0580.01473.64
8.2.280.0480.01373.48
8.2.270.0500.01473.13
8.2.260.0400.01273.77
8.2.250.0410.01373.93
8.2.240.0430.01373.84
8.2.230.0410.01273.91
8.2.220.0430.01373.76
8.2.210.0420.01473.69
8.2.200.0410.01473.80
8.2.190.0430.01273.83
8.2.180.0420.01373.81
8.2.170.0290.01044.60
8.2.160.0280.01044.77
8.2.150.0310.01044.44
8.2.140.0320.00944.51
8.2.130.0310.00844.53
8.2.120.0310.00944.46
8.2.110.0310.00844.47
8.2.100.0290.00944.48
8.2.90.0310.01044.49
8.2.80.0300.00944.40
8.2.70.0280.01044.30
8.2.60.0290.00944.29
8.2.50.0290.00944.28
8.2.40.0290.00844.32
8.2.30.0280.00944.22
8.2.20.0280.00944.28
8.2.10.0280.00944.27
8.2.00.0290.00944.29
8.1.340.0360.00861.07
8.1.330.0640.01476.11
8.1.320.0550.01576.31
8.1.310.0480.01276.05
8.1.300.0410.01276.24
8.1.290.0460.01176.13
8.1.280.0450.01276.13
8.1.270.0270.00845.96
8.1.260.0260.00846.22
8.1.250.0290.00846.01
8.1.240.0290.00845.49
8.1.230.0290.00945.45
8.1.220.0290.00945.52
8.1.210.0290.00945.49
8.1.200.0300.00845.49
8.1.190.0290.00845.38
8.1.180.0300.00945.33
8.1.170.0300.00845.42
8.1.160.0270.01045.34
8.1.150.0280.00945.44
8.1.140.0280.00845.30
8.1.130.0280.00845.42
8.1.120.0280.00845.46
8.1.110.0280.00845.39
8.1.100.0270.00945.49
8.1.90.0260.01045.34
8.1.80.0280.00845.50
8.1.70.0260.00945.39
8.1.60.0290.00945.43
8.1.50.0270.00945.38
8.1.40.0260.01045.44
8.1.30.0280.00945.51
8.1.20.0280.00945.55
8.1.10.0510.01477.32
8.1.00.0440.01377.38
8.0.300.0440.01376.76
8.0.290.0440.01376.75
8.0.280.0440.01276.65
8.0.270.0440.01276.69
8.0.260.0440.01276.68
8.0.250.0430.01376.74
8.0.240.0420.01376.74
8.0.230.0420.01376.74
8.0.220.0430.01276.67
8.0.210.0440.01376.68
8.0.200.0430.01376.74
8.0.190.0430.01376.75
8.0.180.0420.01376.78
8.0.170.0420.01276.77
8.0.160.0420.01376.79
8.0.150.0440.01276.67
8.0.140.0430.01176.75
8.0.130.0430.01376.68
8.0.120.0440.01376.66
8.0.110.0430.01276.68
8.0.100.0410.01376.71
8.0.90.0420.01376.71
8.0.80.0440.01376.72
8.0.70.0420.01276.68
8.0.60.0430.01376.67
8.0.50.0440.01276.70
8.0.30.0420.01476.75
8.0.20.0420.01376.79
8.0.10.0440.01276.87
8.0.00.0420.01377.09
7.4.330.0420.01275.22
7.4.320.0460.01276.42
7.4.300.0430.01276.35
7.4.290.0420.01276.37
7.4.280.0430.01476.34
7.4.270.0430.01276.34
7.4.260.0420.01376.37
7.4.250.0420.01376.37
7.4.240.0440.01276.36
7.4.230.0430.01376.28
7.4.220.0420.01276.36
7.4.210.0410.01376.34
7.4.200.0420.01376.33
7.4.190.0420.01376.39
7.4.180.0420.01176.42
7.4.160.0420.01376.39
7.4.150.0420.01276.33
7.4.140.0420.01376.25
7.4.130.0410.01376.30
7.4.120.0420.01376.25
7.4.110.0430.01376.18
7.4.100.0420.01376.34
7.4.90.0430.01276.30
7.4.80.0410.01376.29
7.4.70.0420.01476.29
7.4.60.0430.01276.29
7.4.50.0410.01476.15
7.4.40.0410.01376.18
7.4.30.0420.01376.25
7.4.20.0420.01376.21
7.4.10.0420.01376.24
7.4.00.0410.01276.26
7.3.330.0420.01276.20
7.3.320.0420.01276.19
7.3.310.0410.01376.21
7.3.300.0420.01276.25
7.3.290.0420.01276.22
7.3.280.0420.01276.19
7.3.270.0410.01376.18
7.3.260.0430.01376.13
7.3.250.0420.01376.10
7.3.240.0410.01476.15
7.3.230.0430.01376.14
7.3.220.0430.01276.13
7.3.210.0430.01276.12
7.3.200.0440.01376.15
7.3.190.0430.01376.09
7.3.180.0430.01376.10
7.3.170.0440.01376.15
7.3.160.0420.01276.12
7.3.150.0410.01476.13
7.3.140.0440.01276.08
7.3.130.0430.01276.09
7.3.120.0420.01376.10
7.3.110.0420.01376.13
7.3.100.0400.01476.07
7.3.90.0430.01376.40
7.3.80.0430.01176.14
7.3.70.0410.01376.32
7.3.60.0430.01376.32
7.3.50.0420.01376.33
7.3.40.0430.01276.31
7.3.30.0430.01376.33
7.3.20.0890.01376.93
7.3.10.0970.01277.09
7.3.00.0840.01277.28

preferences:
66.43 ms | 1444 KiB | 5 Q