3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Rixxi\Utils; class Batch implements \ArrayAccess { /** @var int */ private $limit; /** @var int */ private $counter = 0; /** @var callable */ private $callback; /** @var array */ private $values = array(); /** * @param callable $callback * @param int $limit */ public function __construct(callable $callback, $limit = 1000) { $this->callback = $callback; $this->limit = $limit; } public function __destruct() { $this->flush(); } public function add($value) { $this->values[] = $value; if (++$this->counter === $this->limit) { $this->flush(); } } public function flush() { if ($this->counter !== 0) { $callback = $this->callback; $callback($this->values); $this->values = array(); $this->counter = 0; } } public function offsetSet($index, $value) { if ($index !== NULL) { throw new Exception(); } $this->add($value); } public function offsetGet($index) { throw new NotSupportedException('You can only append to batch.'); } public function offsetExists($index) { throw new NotSupportedException('You can only append to batch.'); } public function offsetUnset($index) { throw new NotSupportedException('You can only append to batch.'); } }

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.3.40.0110.00718.79
8.3.30.0070.00718.64
8.3.20.0030.00518.60
8.3.10.0050.00320.40
8.3.00.0040.00419.25
8.2.170.0110.00422.96
8.2.160.0030.01020.39
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00420.81
8.2.110.0090.00022.27
8.2.100.0040.00817.72
8.2.90.0050.00319.17
8.2.80.0080.00017.97
8.2.70.0030.00617.48
8.2.60.0060.00317.91
8.2.50.0060.00318.07
8.2.40.0080.00017.97
8.2.30.0000.00817.93
8.2.20.0020.00517.54
8.2.10.0030.00517.63
8.2.00.0000.00717.61
8.1.270.0080.00024.66
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0090.00022.05
8.1.230.0080.00417.42
8.1.220.0040.00417.74
8.1.210.0030.00618.77
8.1.200.0060.00317.23
8.1.190.0040.00417.51
8.1.180.0040.00418.10
8.1.170.0040.00418.94
8.1.160.0040.00418.74
8.1.150.0050.00318.60
8.1.140.0040.00417.32
8.1.130.0070.00017.64
8.1.120.0040.00417.40
8.1.110.0040.00417.29
8.1.100.0080.00017.29
8.1.90.0040.00417.30
8.1.80.0040.00417.39
8.1.70.0040.00417.28
8.1.60.0000.00817.44
8.1.50.0070.00317.43
8.1.40.0000.00817.48
8.1.30.0000.00817.59
8.1.20.0000.00717.59
8.1.10.0040.00417.45
8.1.00.0050.00317.35
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0030.00318.39
8.0.270.0030.00317.21
8.0.260.0080.00016.65
8.0.250.0000.00816.92
8.0.240.0030.00616.89
8.0.230.0030.00316.83
8.0.220.0030.00516.89
8.0.210.0080.00016.73
8.0.200.0040.00416.90
8.0.190.0030.00516.79
8.0.180.0000.00816.83
8.0.170.0050.00516.88
8.0.160.0030.00316.87
8.0.150.0050.00316.70
8.0.140.0040.00316.71
8.0.130.0000.00513.21
8.0.120.0040.00416.84
8.0.110.0050.00316.87
8.0.100.0000.00716.85
8.0.90.0000.00716.87
8.0.80.0000.01816.88
8.0.70.0000.00816.63
8.0.60.0050.00316.78
8.0.50.0040.00416.89
8.0.30.0100.01216.85
8.0.20.0150.00717.16
8.0.10.0000.00717.05
8.0.00.0150.00616.77
7.4.330.0000.00512.93
7.4.320.0030.00316.57
7.4.300.0000.00716.44
7.4.290.0030.00316.38
7.4.280.0040.00416.46
7.4.270.0040.00416.44
7.4.260.0050.00013.21
7.4.250.0000.00816.46
7.4.240.0020.00616.46
7.4.230.0040.00416.50
7.4.220.0030.01416.57
7.4.210.0060.00816.52
7.4.200.0050.00216.57
7.4.190.0070.00016.60
7.4.160.0100.00716.45
7.4.150.0070.01116.39
7.4.140.0100.01016.48
7.4.130.0100.00816.41
7.4.120.0110.00716.31
7.4.110.0060.01116.40
7.4.100.0070.01016.56
7.4.90.0140.00416.29
7.4.80.0110.00719.39
7.4.70.0110.00716.61
7.4.60.0120.00316.38
7.4.50.0100.00316.25
7.4.40.0060.00816.52
7.4.30.0120.00316.20
7.4.10.0160.00414.83
7.4.00.0070.00914.66
7.3.330.0030.00313.17
7.3.320.0030.00313.18
7.3.310.0030.00316.14
7.3.300.0000.00616.14
7.3.290.0060.00916.18
7.3.280.0080.00916.19
7.3.270.0180.00616.22
7.3.260.0120.01316.31
7.3.250.0080.01216.29
7.3.240.0070.01016.24
7.3.230.0100.00716.44
7.3.210.0120.00616.36
7.3.200.0060.01016.41
7.3.190.0180.00616.43
7.3.180.0100.00716.27
7.3.170.0130.00316.33
7.3.160.0090.00616.36
7.3.130.0140.00714.88
7.3.120.0100.00814.74
7.3.110.0050.01514.90
7.3.100.0050.01314.84
7.3.90.0030.01214.54
7.3.80.0050.01014.83
7.3.70.0100.00514.80
7.3.60.0050.01114.73
7.3.50.0060.00814.75
7.3.40.0020.01014.77
7.3.30.0050.00814.69
7.3.20.0090.00516.66
7.3.10.0030.00716.61
7.3.00.0070.00516.58
7.2.330.0040.01316.34
7.2.320.0120.00416.45
7.2.310.0060.01216.61
7.2.300.0070.01316.26
7.2.290.0100.00716.59
7.2.260.0130.00714.88
7.2.250.0080.01014.85
7.2.240.0050.01214.86
7.2.230.0080.00914.97
7.2.220.0070.00914.80
7.2.210.0090.00514.80
7.2.200.0020.01214.97
7.2.190.0070.00815.03
7.2.180.0060.00514.90
7.2.170.0070.00614.98
7.2.160.0030.00914.74
7.2.150.0040.01116.57
7.2.140.0040.01116.71
7.2.130.0060.00316.81
7.2.120.0070.01016.74
7.2.110.0030.01116.70
7.2.100.0000.01516.43
7.2.90.0100.00017.05
7.2.80.0040.01116.86
7.2.70.0030.01016.62
7.2.60.0060.00816.87
7.2.50.0030.01316.64
7.2.40.0040.00716.88
7.2.30.0030.01016.52
7.2.20.0030.00716.91
7.2.10.0000.01516.66
7.2.00.0100.00817.81
7.1.330.0050.00815.69
7.1.320.0120.00415.57
7.1.310.0070.00415.62
7.1.300.0070.00715.64
7.1.290.0020.01215.54
7.1.280.0050.00815.69
7.1.270.0010.01015.62
7.1.260.0020.01115.53
7.1.250.0080.00615.50
7.1.240.0100.00315.57
7.1.230.0030.00715.68
7.1.220.0070.00415.76
7.1.210.0040.01115.71
7.1.200.0030.01015.68
7.1.190.0040.00815.46
7.1.180.0000.01115.73
7.1.170.0080.00315.58
7.1.160.0030.01315.40
7.1.150.0000.01115.63
7.1.140.0000.01515.49
7.1.130.0030.01315.78
7.1.120.0040.01115.55
7.1.110.0070.00715.68
7.1.100.0050.00716.71
7.1.90.0050.00515.83
7.1.80.0070.00715.39
7.1.70.0030.00916.47
7.1.60.0070.01217.53
7.1.50.0080.01016.07
7.1.40.0030.00615.78
7.1.30.0070.00315.79
7.1.20.0030.00715.66
7.1.10.0100.00315.51
7.1.00.0010.02319.08
7.0.330.0000.01115.35
7.0.320.0030.01015.43
7.0.310.0030.00714.94
7.0.300.0110.00415.43
7.0.290.0070.00715.32
7.0.280.0040.00915.10
7.0.270.0060.00615.22
7.0.260.0080.00515.21
7.0.250.0030.01215.32
7.0.240.0060.00615.29
7.0.230.0030.01015.41
7.0.220.0060.00615.12
7.0.210.0100.00015.44
7.0.200.0040.00716.04
7.0.190.0070.00715.04
7.0.180.0030.00915.39
7.0.170.0030.00615.00
7.0.160.0080.00415.04
7.0.150.0030.00915.02
7.0.140.0030.04118.65
7.0.130.0070.00615.27
7.0.120.0020.04018.62
7.0.110.0060.00915.47
7.0.100.0030.01015.26
7.0.90.0070.00315.43
7.0.80.0030.00715.26
7.0.70.0030.01415.40
7.0.60.0050.04417.43
7.0.50.0070.03316.50
7.0.40.0080.04315.61
7.0.30.0070.02415.58
7.0.20.0050.02715.65
7.0.10.0050.02515.44
7.0.00.0080.04215.60
5.6.400.0030.00713.81
5.6.390.0060.00613.99
5.6.380.0110.00314.37
5.6.370.0070.01014.45
5.6.360.0100.00614.05
5.6.350.0080.00813.93
5.6.340.0040.00814.60
5.6.330.0050.00514.36
5.6.320.0100.00314.32
5.6.310.0060.00614.44
5.6.300.0040.01114.07
5.6.290.0070.00714.13
5.6.280.0020.04517.62
5.6.270.0060.00314.30
5.6.260.0030.01014.29
5.6.250.0070.01014.22
5.6.240.0000.01014.26
5.6.230.0030.01414.26
5.6.220.0060.00314.31
5.6.210.0030.02617.47
5.6.200.0060.03816.07
5.6.190.0060.02516.35
5.6.180.0080.03816.17
5.6.170.0020.04516.25
5.6.160.0050.03016.04
5.6.150.0070.03616.28
5.6.140.0080.03816.17
5.6.130.0050.04516.19
5.6.120.0000.03016.16
5.6.110.0110.04216.19
5.6.100.0150.03516.29
5.6.90.0070.04016.12
5.6.80.0100.04215.86
5.6.70.0030.03015.90
5.6.60.0070.03915.99
5.6.50.0050.04415.84
5.6.40.0070.04015.78
5.6.30.0140.02115.87
5.6.20.0040.03315.76
5.6.10.0050.04615.80
5.6.00.0070.04015.75
5.5.380.0070.00714.29
5.5.370.0040.01114.11
5.5.360.0030.00914.07
5.5.350.0150.03617.22
5.5.340.0050.02716.23
5.5.330.0080.04215.89
5.5.320.0060.04416.07
5.5.310.0090.02316.01
5.5.300.0050.03715.96
5.5.290.0070.02516.09
5.5.280.0080.02715.99
5.5.270.0030.04715.86
5.5.260.0070.03516.03
5.5.250.0030.04016.07
5.5.240.0030.02815.79
5.5.230.0080.04215.66
5.5.220.0060.03915.61
5.5.210.0030.04315.71
5.5.200.0050.03715.75
5.5.190.0000.05115.67
5.5.180.0080.03015.57
5.5.170.0060.00613.89
5.5.160.0090.03915.62
5.5.150.0050.04415.64
5.5.140.0040.04215.48
5.5.130.0080.03715.62
5.5.120.0070.03015.57
5.5.110.0050.04615.69
5.5.100.0100.04015.45
5.5.90.0070.03715.69
5.5.80.0050.04015.40
5.5.70.0070.03915.68
5.5.60.0050.03815.67
5.5.50.0030.04715.65
5.5.40.0110.03815.46
5.5.30.0050.04015.68
5.5.20.0030.03315.66
5.5.10.0050.04215.65
5.5.00.0090.03715.36
5.4.450.0050.04315.80
5.4.440.0100.03815.81
5.4.430.0050.03815.79
5.4.420.0080.03815.81
5.4.410.0080.02815.74
5.4.400.0060.02415.67
5.4.390.0050.04015.67
5.4.380.0100.03715.67
5.4.370.0070.04015.60
5.4.360.0140.03515.67
5.4.350.0060.03315.61
5.4.340.0100.04015.64
5.4.330.0030.00312.25
5.4.320.0100.03215.64
5.4.310.0080.04015.65
5.4.300.0070.04215.62
5.4.290.0070.03215.61
5.4.280.0030.02515.68
5.4.270.0100.03815.67
5.4.260.0070.03715.73
5.4.250.0060.02315.64
5.4.240.0040.04515.68
5.4.230.0030.04115.56
5.4.220.0130.03615.67
5.4.210.0050.02915.61
5.4.200.0050.03015.67
5.4.190.0030.04515.56
5.4.180.0080.02315.61
5.4.170.0030.02215.68
5.4.160.0090.03515.59
5.4.150.0070.03815.67
5.4.140.0040.04314.35
5.4.130.0070.03814.29
5.4.120.0030.04014.32
5.4.110.0050.04214.29
5.4.100.0060.03314.36
5.4.90.0050.03214.35
5.4.80.0060.02814.36
5.4.70.0060.01814.31
5.4.60.0070.03314.39
5.4.50.0080.03614.26
5.4.40.0070.03314.33
5.4.30.0030.02414.39
5.4.20.0020.03614.28
5.4.10.0100.02814.28
5.4.00.0080.03714.11
5.3.290.0050.04113.44
5.3.280.0080.03713.43
5.3.270.0060.02513.41
5.3.260.0070.03813.48
5.3.250.0050.03813.45
5.3.240.0050.03113.44
5.3.230.0020.03213.48
5.3.220.0060.02013.43
5.3.210.0030.02513.44
5.3.200.0050.02713.46
5.3.190.0050.04013.42
5.3.180.0050.03113.52
5.3.170.0030.02913.42
5.3.160.0030.02013.40
5.3.150.0030.03313.43
5.3.140.0080.03313.44
5.3.130.0000.02813.42
5.3.120.0050.04613.40
5.3.110.0080.02813.34
5.3.100.0030.02713.15
5.3.90.0030.04413.14
5.3.80.0060.02513.14
5.3.70.0030.03513.24
5.3.60.0100.03513.12
5.3.50.0000.03413.10
5.3.40.0080.02013.05
5.3.30.0080.03313.11
5.3.20.0070.04213.00
5.3.10.0020.03312.97
5.3.00.0050.03312.97
5.2.170.0030.05011.13
5.2.160.0070.05010.93
5.2.150.0030.06711.17
5.2.140.0070.05311.11
5.2.130.0000.06311.13
5.2.120.0030.05011.00
5.2.110.0170.03311.09
5.2.100.0000.06711.06
5.2.90.0100.05711.05
5.2.80.0000.04711.01
5.2.70.0100.05711.12
5.2.60.0030.06711.02
5.2.50.0030.05010.84
5.2.40.0000.03310.99
5.2.30.0030.03010.96
5.2.20.0000.03011.10
5.2.10.0100.05310.86
5.2.00.0070.05710.61
5.1.60.0070.05310.00
5.1.50.0070.0509.91
5.1.40.0030.0409.91
5.1.30.0030.06010.33
5.1.20.0200.02710.38
5.1.10.0000.06010.11
5.1.00.0100.0479.90
5.0.50.0000.0508.45
5.0.40.0030.0408.39
5.0.30.0000.0438.19
5.0.20.0000.0378.27
5.0.10.0000.0478.21
5.0.00.0070.0608.15
4.4.90.0030.0207.76
4.4.80.0130.0207.76
4.4.70.0030.0377.76
4.4.60.0000.0377.76
4.4.50.0000.0237.76
4.4.40.0000.0537.76
4.4.30.0100.0277.76
4.4.20.0100.0277.76
4.4.10.0070.0177.76
4.4.00.0100.0477.76
4.3.110.0030.0377.76
4.3.100.0000.0177.76
4.3.90.0000.0207.76
4.3.80.0070.0437.76
4.3.70.0000.0237.76
4.3.60.0000.0207.76
4.3.50.0000.0337.76
4.3.40.0030.0507.76
4.3.30.0000.0407.76
4.3.20.0000.0407.76
4.3.10.0000.0337.76
4.3.00.0030.0307.76

preferences:
42.98 ms | 400 KiB | 5 Q