3v4l.org

run code in 300+ PHP versions simultaneously
<?php class LargeObject { protected $array; public function __construct() { $this->array = array_fill(0, 1000, 17); } public function getItemProcessor(): Closure { // Try with and without 'static' here return static function () { // do some processing unrelated to $this }; } } $start = microtime(true); $processors = []; for ($i = 0; $i < 1000; $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.0130.01217.75
8.4.110.0200.01118.76
8.4.100.0330.00917.97
8.4.90.0300.00618.06
8.4.80.0290.00918.08
8.4.70.0260.00618.29
8.4.60.0260.00718.17
8.4.50.0210.01117.91
8.4.40.0280.00717.86
8.4.30.0200.01017.96
8.4.20.0220.00817.93
8.4.10.0240.00418.12
8.3.240.0150.00717.02
8.3.230.0170.00516.88
8.3.220.0210.00716.82
8.3.210.0270.00916.78
8.3.200.0220.00717.18
8.3.190.0290.00816.97
8.3.180.0260.01016.88
8.3.170.0290.00516.85
8.3.160.0270.00917.06
8.3.150.0320.01017.02
8.3.140.0260.01017.01
8.3.130.0250.00816.77
8.3.120.0270.00716.88
8.3.110.0300.00916.79
8.3.100.0360.00616.86
8.3.90.0290.01416.97
8.3.80.0300.00920.42
8.3.70.0320.00820.43
8.3.60.0260.00820.35
8.3.50.0190.00720.48
8.3.40.0270.00621.16
8.3.30.0230.00721.05
8.3.20.0230.00621.14
8.3.10.0270.00721.16
8.3.00.0270.00721.52
8.2.290.0190.00816.83
8.2.280.0260.00517.12
8.2.270.0240.00816.84
8.2.260.0250.00816.96
8.2.250.0250.00716.91
8.2.240.0240.01017.07
8.2.230.0180.00816.86
8.2.220.0170.00816.95
8.2.210.0260.00416.77
8.2.200.0250.00920.33
8.2.190.0220.00720.33
8.2.180.0250.00720.31
8.2.170.0300.00621.22
8.2.160.0280.00821.23
8.2.150.0220.00621.17
8.2.140.0220.00821.06
8.2.130.0220.00421.19
8.2.120.0210.00621.25
8.2.110.0330.00821.18
8.2.100.0290.01021.25
8.2.90.0280.01121.15
8.2.80.0310.01021.06
8.2.70.0300.00921.03
8.2.60.0280.01121.08
8.2.50.0230.01120.78
8.2.40.0250.00820.84
8.2.30.0200.00720.36
8.2.20.0170.00920.37
8.2.10.0160.00819.59
8.2.00.0200.00719.59
8.1.330.0230.00916.62
8.1.320.0250.00716.47
8.1.310.0140.00616.63
8.1.300.0250.00916.50
8.1.290.0260.01120.01
8.1.280.0270.01019.96
8.1.270.0280.01121.02
8.1.260.0250.01121.01
8.1.250.0280.01121.02
8.1.240.0270.01121.08
8.1.230.0280.01020.97
8.1.220.0290.00820.94
8.1.210.0280.00820.98
8.1.200.0250.00721.02
8.1.190.0230.01220.92
8.1.180.0210.00920.64
8.1.170.0250.00620.60
8.1.160.0200.00820.23
8.1.150.0210.00520.10
8.1.140.0150.00719.43
8.1.130.0160.00719.46
8.1.120.0180.00719.47
8.1.110.0180.00619.43
8.1.100.0140.00819.49
8.1.90.0140.00819.52
8.1.80.0130.00819.09
8.1.70.0190.00619.33
8.1.60.0170.01219.49
8.1.50.0180.00919.42
8.1.40.0190.00819.29
8.1.30.0190.00619.33
8.1.20.0170.00719.32
8.1.10.0150.00819.26
8.1.00.0160.00819.24
8.0.300.0220.01120.48
8.0.290.0250.00820.33
8.0.280.0230.00819.69
8.0.270.0160.00818.89
8.0.260.0140.00718.88
8.0.250.0170.00718.92
8.0.240.0160.00918.90
8.0.230.0150.00918.88
8.0.220.0140.00918.87
8.0.210.0130.00818.44
8.0.200.0180.00718.68
8.0.190.0150.01018.74
8.0.180.0160.00818.80
8.0.170.0150.00618.65
8.0.160.0130.00818.61
8.0.150.0140.00718.57
8.0.140.0140.00818.54
8.0.130.0150.00718.54
8.0.120.0120.00918.63
8.0.110.0150.00818.58
8.0.100.0150.00718.51
8.0.90.0120.00918.49
8.0.80.0140.00818.60
8.0.70.0190.00618.57
8.0.60.0130.00918.58
8.0.50.0140.00818.55
8.0.30.0170.00718.60
8.0.20.0170.00718.65
8.0.10.0180.00618.66
7.4.330.0160.00718.48
7.4.320.0180.00718.63
7.4.300.0140.00718.22
7.4.290.0160.00918.50
7.4.280.0160.00618.35
7.4.270.0130.00918.33
7.4.260.0130.00618.36
7.4.250.0150.00818.30
7.4.240.0150.00718.41
7.4.230.0180.00718.34
7.4.220.0150.00718.31
7.4.210.0130.00818.35
7.4.200.0140.00518.31
7.4.190.0130.00718.37
7.4.180.0150.00718.38
7.4.160.0160.00718.37
7.4.150.0150.00618.35
7.4.140.0160.00718.26
7.4.130.0140.00918.26
7.4.120.0170.00718.28
7.4.110.0190.00618.23
7.4.100.0170.00618.34
7.4.90.0150.00718.26
7.4.80.0140.00618.26
7.4.70.0140.00918.26
7.4.60.0160.00718.31
7.4.50.0150.00718.21
7.4.40.0140.00818.22
7.4.30.0120.00818.30
7.4.20.0130.00618.29
7.4.10.0140.00718.32
7.4.00.0170.00418.25

preferences:
34.24 ms | 403 KiB | 5 Q