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.90.0780.01773.45
8.5.80.0630.01873.63
8.5.70.0680.01773.38
8.5.60.0500.01473.05
8.5.50.0480.01772.93
8.5.40.0410.01373.08
8.5.30.0430.01472.83
8.5.20.0400.01372.98
8.5.10.0450.01573.07
8.5.00.0640.01772.96
8.4.240.0460.01456.46
8.4.230.0510.02156.42
8.4.220.0430.01756.51
8.4.210.0370.01456.44
8.4.200.0560.02056.39
8.4.190.0470.01556.26
8.4.180.0410.01356.47
8.4.170.0370.01256.52
8.4.160.0360.01056.59
8.4.150.0420.01456.43
8.4.140.0630.02074.09
8.4.130.0620.01574.12
8.4.120.0590.01874.31
8.4.110.0540.01874.25
8.4.100.0510.01174.29
8.4.90.0410.01374.28
8.4.80.0550.01574.29
8.4.70.0560.01474.33
8.4.60.0550.01574.30
8.4.50.0640.01674.17
8.4.40.0530.01674.12
8.4.30.0590.01874.14
8.4.20.0540.01474.11
8.4.10.0460.01475.42
8.3.330.0430.01558.83
8.3.320.0500.01158.66
8.3.310.0460.01358.77
8.3.300.0390.01758.55
8.3.290.0440.01658.73
8.3.280.0410.01358.64
8.3.270.0590.01273.13
8.3.260.0490.01473.11
8.3.250.0510.01573.10
8.3.240.0600.01773.00
8.3.230.0590.01673.02
8.3.220.0460.01473.17
8.3.210.0480.01573.08
8.3.200.0510.01573.10
8.3.190.0530.01873.05
8.3.180.0500.01373.00
8.3.170.0510.01473.19
8.3.160.0530.01273.15
8.3.150.0520.01473.09
8.3.140.0550.01674.03
8.3.130.0420.01473.93
8.3.120.0430.01374.04
8.3.110.0430.01374.06
8.3.100.0460.01273.98
8.3.90.0460.01273.87
8.3.80.0450.01373.89
8.3.70.0480.01473.92
8.3.60.0460.01473.91
8.3.50.0450.01573.94
8.3.40.0280.00944.44
8.3.30.0280.01144.55
8.3.20.0300.01044.67
8.3.10.0310.01044.89
8.3.00.0260.01044.55
8.2.330.0520.01859.06
8.2.320.0340.01058.31
8.2.310.0420.01158.50
8.2.300.0460.01158.74
8.2.290.0590.01373.41
8.2.280.0460.01373.35
8.2.270.0510.01573.09
8.2.260.0400.01273.73
8.2.250.0410.01373.90
8.2.240.0430.01373.80
8.2.230.0410.01273.86
8.2.220.0430.01373.73
8.2.210.0420.01473.65
8.2.200.0410.01473.77
8.2.190.0430.01273.79
8.2.180.0420.01373.78
8.2.170.0290.01044.59
8.2.160.0280.01044.75
8.2.150.0320.01044.43
8.2.140.0320.00944.50
8.2.130.0310.00844.52
8.2.120.0320.00944.45
8.2.110.0310.00844.45
8.2.100.0300.01044.47
8.2.90.0310.01044.49
8.2.80.0300.00944.39
8.2.70.0280.01044.29
8.2.60.0290.00944.28
8.2.50.0300.00944.27
8.2.40.0290.00844.31
8.2.30.0280.00944.22
8.2.20.0280.00944.27
8.2.10.0290.00944.26
8.2.00.0300.00944.28
8.1.340.0440.01160.57
8.1.330.0620.01575.95
8.1.320.0540.01576.15
8.1.310.0480.01376.02
8.1.300.0410.01376.21
8.1.290.0460.01176.11
8.1.280.0450.01276.11
8.1.270.0260.00845.94
8.1.260.0270.00846.19
8.1.250.0290.00845.99
8.1.240.0290.00845.48
8.1.230.0300.00945.44
8.1.220.0290.00945.52
8.1.210.0290.00945.48
8.1.200.0300.00845.48
8.1.190.0290.00845.37
8.1.180.0300.00945.33
8.1.170.0300.00845.42
8.1.160.0270.01045.34
8.1.150.0290.00945.44
8.1.140.0280.00845.30
8.1.130.0290.00845.42
8.1.120.0280.00845.46
8.1.110.0280.00845.39
8.1.100.0270.00945.48
8.1.90.0270.01045.34
8.1.80.0280.00845.50
8.1.70.0260.01045.39
8.1.60.0290.00945.43
8.1.50.0270.00945.37
8.1.40.0260.01045.43
8.1.30.0280.00945.51
8.1.20.0280.00945.54
8.1.10.0510.01477.32
8.1.00.0440.01377.37
8.0.300.0440.01376.76
8.0.290.0450.01476.74
8.0.280.0440.01276.64
8.0.270.0430.01276.68
8.0.260.0430.01276.68
8.0.250.0430.01376.73
8.0.240.0430.01376.74
8.0.230.0420.01376.73
8.0.220.0430.01276.66
8.0.210.0440.01376.68
8.0.200.0430.01376.73
8.0.190.0430.01376.74
8.0.180.0420.01276.78
8.0.170.0420.01276.77
8.0.160.0420.01376.78
8.0.150.0440.01276.67
8.0.140.0430.01176.74
8.0.130.0430.01376.68
8.0.120.0440.01376.66
8.0.110.0430.01276.68
8.0.100.0410.01376.70
8.0.90.0420.01376.70
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.0430.01275.25
7.4.320.0460.01276.41
7.4.300.0430.01276.35
7.4.290.0420.01276.36
7.4.280.0430.01376.34
7.4.270.0430.01276.34
7.4.260.0420.01376.36
7.4.250.0420.01376.36
7.4.240.0430.01276.36
7.4.230.0430.01376.28
7.4.220.0420.01276.36
7.4.210.0410.01376.33
7.4.200.0430.01376.32
7.4.190.0430.01376.39
7.4.180.0420.01176.41
7.4.160.0430.01376.39
7.4.150.0420.01276.33
7.4.140.0420.01376.24
7.4.130.0420.01376.29
7.4.120.0430.01376.24
7.4.110.0430.01376.17
7.4.100.0420.01376.33
7.4.90.0440.01376.30
7.4.80.0410.01376.28
7.4.70.0420.01476.28
7.4.60.0430.01276.29
7.4.50.0410.01476.14
7.4.40.0410.01376.17
7.4.30.0420.01376.24
7.4.20.0420.01376.20
7.4.10.0420.01376.23
7.4.00.0410.01276.25
7.3.330.0420.01176.19
7.3.320.0420.01276.18
7.3.310.0410.01376.20
7.3.300.0420.01276.24
7.3.290.0420.01276.21
7.3.280.0420.01276.18
7.3.270.0410.01476.17
7.3.260.0430.01276.12
7.3.250.0420.01376.09
7.3.240.0410.01476.14
7.3.230.0430.01376.13
7.3.220.0440.01276.12
7.3.210.0430.01276.11
7.3.200.0440.01276.14
7.3.190.0430.01376.08
7.3.180.0430.01376.09
7.3.170.0440.01376.14
7.3.160.0430.01276.11
7.3.150.0420.01476.12
7.3.140.0440.01276.08
7.3.130.0430.01276.09
7.3.120.0420.01376.09
7.3.110.0420.01376.12
7.3.100.0410.01376.06
7.3.90.0430.01376.39
7.3.80.0430.01176.13
7.3.70.0410.01376.31
7.3.60.0430.01376.31
7.3.50.0430.01376.32
7.3.40.0430.01276.30
7.3.30.0430.01376.32
7.3.20.0900.01376.97
7.3.10.0960.01277.12
7.3.00.0840.01277.30

preferences:
54.61 ms | 1476 KiB | 5 Q