3v4l.org

run code in 300+ 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.00.1060.02172.64
8.4.140.1150.03474.11
8.4.130.0770.01974.13
8.4.120.0670.01774.35
8.4.110.0660.01874.22
8.4.100.0600.01374.31
8.4.90.0440.01374.30
8.4.80.0630.01774.29
8.4.70.0640.01774.35
8.4.60.0610.01874.34
8.4.50.0720.01774.13
8.4.40.0600.01774.05
8.4.30.0650.01974.14
8.4.20.0570.01574.12
8.4.10.0470.01475.69
8.3.270.0920.01572.99
8.3.260.0480.01473.04
8.3.250.0560.01473.09
8.3.240.0640.01772.96
8.3.230.0700.01972.91
8.3.220.0440.01173.23
8.3.210.0500.01773.05
8.3.200.0550.01773.04
8.3.190.0550.01773.06
8.3.180.0520.01473.04
8.3.170.0540.01473.17
8.3.160.0570.01273.12
8.3.150.0540.01573.08
8.3.140.0560.01674.06
8.3.130.0420.01473.95
8.3.120.0430.01374.08
8.3.110.0430.01374.08
8.3.100.0460.01274.01
8.3.90.0460.01273.87
8.3.80.0460.01373.90
8.3.70.0480.01473.93
8.3.60.0460.01473.92
8.3.50.0450.01573.95
8.3.40.0280.00944.51
8.3.30.0290.01144.62
8.3.20.0300.00944.77
8.3.10.0320.01044.99
8.3.00.0260.01044.64
8.2.290.0630.01673.23
8.2.280.0500.01473.20
8.2.270.0510.01572.93
8.2.260.0400.01273.74
8.2.250.0410.01373.92
8.2.240.0430.01373.82
8.2.230.0410.01273.90
8.2.220.0430.01373.73
8.2.210.0420.01473.67
8.2.200.0410.01473.79
8.2.190.0430.01273.83
8.2.180.0420.01373.80
8.2.170.0290.01044.58
8.2.160.0280.01044.75
8.2.150.0320.01044.42
8.2.140.0320.00944.50
8.2.130.0310.00844.52
8.2.120.0310.00944.43
8.2.110.0310.00844.43
8.2.100.0300.00944.45
8.2.90.0310.01044.47
8.2.80.0300.00944.38
8.2.70.0280.01044.27
8.2.60.0290.00944.27
8.2.50.0300.00944.27
8.2.40.0290.00844.30
8.2.30.0280.00944.20
8.2.20.0280.00944.27
8.2.10.0290.00944.24
8.2.00.0290.00944.28
8.1.330.0740.01475.81
8.1.320.0590.01676.12
8.1.310.0480.01276.03
8.1.300.0410.01276.22
8.1.290.0460.01176.11
8.1.280.0450.01276.13
8.1.270.0260.00845.96
8.1.260.0260.00846.21
8.1.250.0290.00846.01
8.1.240.0290.00845.48
8.1.230.0290.00945.43
8.1.220.0290.00945.51
8.1.210.0290.00945.48
8.1.200.0300.00845.47
8.1.190.0290.00845.38
8.1.180.0300.00945.33
8.1.170.0300.00845.41
8.1.160.0270.01045.34
8.1.150.0280.00945.44
8.1.140.0280.00845.29
8.1.130.0280.00845.42
8.1.120.0280.00845.46
8.1.110.0280.00845.38
8.1.100.0270.00945.49
8.1.90.0260.01045.33
8.1.80.0280.00845.49
8.1.70.0260.00945.38
8.1.60.0290.00945.42
8.1.50.0270.00945.37
8.1.40.0260.01045.44
8.1.30.0280.00945.49
8.1.20.0280.00945.53
8.1.10.0510.01477.31
8.1.00.0440.01377.37
8.0.300.0450.01376.75
8.0.290.0450.01476.74
8.0.280.0440.01276.64
8.0.270.0440.01276.68
8.0.260.0440.01276.67
8.0.250.0430.01376.72
8.0.240.0430.01376.73
8.0.230.0420.01376.73
8.0.220.0430.01276.65
8.0.210.0440.01376.67
8.0.200.0430.01476.72
8.0.190.0430.01376.73
8.0.180.0420.01376.77
8.0.170.0420.01276.76
8.0.160.0420.01376.77
8.0.150.0440.01276.67
8.0.140.0430.01176.74
8.0.130.0430.01376.67
8.0.120.0440.01376.65
8.0.110.0430.01276.67
8.0.100.0410.01376.70
8.0.90.0420.01376.69
8.0.80.0440.01376.71
8.0.70.0420.01276.67
8.0.60.0430.01376.65
8.0.50.0440.01376.69
8.0.30.0420.01476.74
8.0.20.0420.01376.78
8.0.10.0440.01276.86
8.0.00.0420.01377.09
7.4.330.0430.01275.18
7.4.320.0460.01276.41
7.4.300.0430.01276.34
7.4.290.0420.01276.36
7.4.280.0430.01476.33
7.4.270.0430.01276.33
7.4.260.0420.01376.35
7.4.250.0420.01376.36
7.4.240.0440.01276.35
7.4.230.0430.01376.27
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.40
7.4.160.0420.01376.38
7.4.150.0420.01276.32
7.4.140.0420.01376.24
7.4.130.0410.01376.28
7.4.120.0430.01376.24
7.4.110.0430.01376.17
7.4.100.0420.01376.34
7.4.90.0430.01376.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.20
7.4.10.0420.01376.25
7.4.00.0410.01276.27
7.3.330.0420.01276.19
7.3.320.0420.01376.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.01376.17
7.3.260.0430.01376.12
7.3.250.0420.01376.08
7.3.240.0410.01476.13
7.3.230.0430.01376.13
7.3.220.0440.01376.12
7.3.210.0430.01276.11
7.3.200.0440.01376.14
7.3.190.0430.01376.08
7.3.180.0430.01376.09
7.3.170.0440.01376.14
7.3.160.0420.01276.11
7.3.150.0410.01476.12
7.3.140.0440.01276.07
7.3.130.0430.01276.08
7.3.120.0420.01376.09
7.3.110.0420.01376.12
7.3.100.0400.01476.07
7.3.90.0430.01376.38
7.3.80.0430.01176.13
7.3.70.0410.01376.31
7.3.60.0430.01376.30
7.3.50.0420.01376.32
7.3.40.0430.01276.30
7.3.30.0430.01376.32
7.3.20.0890.01376.92
7.3.10.0970.01277.08
7.3.00.0830.01277.27

preferences:
36.66 ms | 475 KiB | 5 Q