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 = []; $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.60.0140.00416.48
8.3.50.0130.01017.46
8.3.40.0140.00718.62
8.3.30.0110.00418.67
8.3.20.0080.00018.63
8.3.10.0080.00018.69
8.3.00.0040.00419.25
8.2.180.0110.01118.11
8.2.170.0070.00722.96
8.2.160.0060.00918.96
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0000.00819.49
8.2.110.0030.00720.35
8.2.100.0070.00417.90
8.2.90.0110.00019.06
8.2.80.0000.00817.97
8.2.70.0080.00017.63
8.2.60.0050.00217.93
8.2.50.0060.00318.07
8.2.40.0030.00519.19
8.2.30.0000.01017.69
8.2.20.0030.00617.63
8.2.10.0000.00819.46
8.2.00.0030.00817.31
8.1.280.0170.00325.92
8.1.270.0040.00423.99
8.1.260.0000.00826.35
8.1.250.0070.00028.09
8.1.240.0100.00023.98
8.1.230.0040.00717.77
8.1.220.0040.00417.74
8.1.210.0060.00318.77
8.1.200.0030.00617.23
8.1.190.0100.00017.11
8.1.180.0000.00818.10
8.1.170.0000.01118.57
8.1.160.0040.00418.81
8.1.150.0040.00418.47
8.1.140.0000.00717.37
8.1.130.0030.00317.32
8.1.120.0000.00717.41
8.1.110.0040.00417.32
8.1.100.0050.00317.27
8.1.90.0040.00417.28
8.1.80.0070.00017.29
8.1.70.0050.00317.41
8.1.60.0030.00617.54
8.1.50.0050.00217.34
8.1.40.0030.00517.43
8.1.30.0030.00617.54
8.1.20.0000.01017.66
8.1.10.0000.00717.46
8.1.00.0040.00417.23
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0000.00718.64
8.0.270.0030.00317.21
8.0.260.0030.00316.77
8.0.250.0050.00516.95
8.0.240.0000.00816.94
8.0.230.0030.00516.87
8.0.220.0000.01016.71
8.0.210.0000.00716.89
8.0.200.0030.00316.93
8.0.190.0030.00616.86
8.0.180.0000.00716.91
8.0.170.0050.00316.78
8.0.160.0040.00416.78
8.0.150.0000.00816.71
8.0.140.0020.00516.79
8.0.130.0000.00513.25
8.0.120.0030.00616.74
8.0.110.0030.00716.81
8.0.100.0030.00416.85
8.0.90.0000.00716.84
8.0.80.0090.00616.81
8.0.70.0040.00416.68
8.0.60.0050.00316.69
8.0.50.0090.00016.90
8.0.30.0100.01016.90
8.0.20.0130.00817.03
8.0.10.0040.00417.03
8.0.00.0100.00916.71
7.4.330.0060.00012.87
7.4.320.0000.00716.57
7.4.300.0000.00716.53
7.4.290.0070.00016.42
7.4.280.0040.00716.52
7.4.270.0060.00016.45
7.4.260.0000.00713.25
7.4.250.0040.00416.54
7.4.240.0030.00316.57
7.4.230.0060.00316.54
7.4.220.0060.00916.41
7.4.210.0060.01516.49
7.4.200.0030.00316.39
7.4.190.0050.00516.63
7.4.160.0110.01116.43
7.4.150.0140.00416.28
7.4.140.0170.00717.86
7.4.130.0040.01516.44
7.4.120.0070.01116.46
7.4.110.0120.00616.27
7.4.100.0030.01416.32
7.4.90.0140.00716.25
7.4.80.0150.00919.39
7.4.70.0070.01016.17
7.4.60.0120.00416.38
7.4.50.0060.00016.28
7.4.40.0040.01116.34
7.4.30.0060.01016.38
7.4.00.0110.00514.75
7.3.330.0060.00013.19
7.3.320.0020.00213.17
7.3.310.0040.00416.08
7.3.300.0030.00316.20
7.3.290.0080.00716.19
7.3.280.0200.00016.07
7.3.270.0030.01416.30
7.3.260.0030.01416.18
7.3.240.0070.01016.50
7.3.230.0060.01316.36
7.3.210.0130.00316.18
7.3.200.0060.01416.50
7.3.190.0100.01316.45
7.3.180.0080.00816.45
7.3.170.0090.00616.34
7.3.160.0180.00616.21
7.3.120.0080.00814.80
7.3.110.0000.01714.58
7.3.100.0090.00914.78
7.3.90.0050.00514.42
7.3.80.0070.01014.66
7.3.70.0030.01114.58
7.3.60.0000.01314.51
7.3.50.0030.01014.72
7.3.40.0040.01114.34
7.3.30.0070.00714.37
7.3.20.0040.00716.23
7.3.10.0070.00916.69
7.3.00.0040.01016.34
7.2.330.0050.01216.23
7.2.320.0090.01216.34
7.2.310.0150.00416.52
7.2.300.0140.00416.45
7.2.290.0100.00716.24
7.2.250.0040.01114.67
7.2.240.0070.01314.79
7.2.230.0090.00614.99
7.2.220.0030.01014.96
7.2.210.0030.01114.88
7.2.200.0040.01114.99
7.2.190.0090.00614.96
7.2.180.0070.00714.83
7.2.170.0090.00614.86
7.2.130.0090.00616.96
7.2.120.0070.00716.68
7.2.110.0070.01016.49
7.2.100.0140.00016.74
7.2.90.0090.00616.75
7.2.80.0090.00716.29
7.2.70.0070.01416.39
7.2.60.0070.00516.77
7.2.50.0030.01016.79
7.2.40.0030.00716.91
7.2.30.0120.00316.84
7.2.20.0040.01116.51
7.2.10.0040.00716.82
7.2.00.0110.00316.96
7.1.330.0040.01115.47
7.1.320.0050.00515.30
7.1.310.0030.01015.66
7.1.300.0120.00015.61
7.1.290.0040.01115.62
7.1.280.0060.00615.44
7.1.270.0120.00015.49
7.1.260.0070.00715.70
7.1.250.0090.00615.65
7.1.200.0040.00815.78
7.1.70.0060.00316.90
7.1.60.0100.01419.21
7.1.50.0100.01316.89
7.1.00.0030.03722.47
7.0.200.0050.00316.67
7.0.140.0100.06721.99
7.0.120.0070.05322.20
7.0.110.0070.04719.89
7.0.100.0030.06019.98
7.0.90.0070.04719.91
7.0.80.0030.04719.94
7.0.70.0100.06019.91
7.0.60.0100.03720.03
7.0.50.0070.04320.39
7.0.40.0000.04320.25
7.0.30.0100.07320.25
7.0.20.0030.04320.18
7.0.10.0130.03320.04
7.0.00.0100.06720.18
5.6.280.0070.07021.05
5.6.260.0030.07320.71
5.6.250.0030.04720.67
5.6.240.0030.04320.69
5.6.230.0070.04020.70
5.6.220.0030.05320.69
5.6.210.0100.03020.67
5.6.200.0030.05021.16
5.6.190.0030.04321.13
5.6.180.0200.07021.29
5.6.170.0070.04021.13
5.6.160.0000.04320.97
5.6.150.0070.04021.07
5.6.140.0030.05721.15
5.6.130.0100.03320.97
5.6.120.0030.04320.94
5.6.110.0100.09020.94
5.6.100.0070.05020.94
5.6.90.0070.04020.95
5.6.80.0030.04320.35
5.6.70.0070.03720.61
5.6.60.0070.03720.34
5.6.50.0070.05720.31
5.6.40.0100.03020.45
5.6.30.0070.04020.37
5.6.20.0130.05020.30
5.6.10.0000.05020.46
5.6.00.0030.05720.50
5.5.380.0070.03720.27
5.5.370.0100.03720.27
5.5.360.0030.04320.47
5.5.350.0100.03020.48
5.5.340.0130.02720.76
5.5.330.0030.04020.97
5.5.320.0070.04720.92
5.5.310.0070.04721.01
5.5.300.0100.03320.96
5.5.290.0070.05320.70
5.5.280.0000.04320.82
5.5.270.0030.03720.91
5.5.260.0030.06320.71
5.5.250.0000.05720.64
5.5.240.0030.03720.14
5.5.230.0070.04320.24
5.5.220.0070.03020.25
5.5.210.0130.03020.28
5.5.200.0030.04020.34
5.5.190.0030.04320.18
5.5.180.0030.06720.27
5.5.160.0200.06320.25
5.5.150.0030.08020.30
5.5.140.0130.07320.26
5.5.130.0130.04020.34
5.5.120.0000.08320.32
5.5.110.0070.07720.33
5.5.100.0170.07320.13
5.5.90.0000.08320.15
5.5.80.0170.06720.02
5.5.70.0100.05320.14
5.5.60.0030.06020.21
5.5.50.0130.07720.05
5.5.40.0030.05320.25
5.5.30.0030.07720.14
5.5.20.0070.07320.25
5.5.10.0170.07020.12
5.5.00.0100.08020.03
5.4.450.0030.05019.55
5.4.440.0030.04019.34
5.4.430.0130.06019.41
5.4.420.0130.04319.43
5.4.410.0030.05319.20
5.4.400.0030.05719.00
5.4.390.0000.04019.18
5.4.380.0030.04719.14
5.4.370.0030.03718.99
5.4.360.0070.04019.01
5.4.350.0100.05019.18
5.4.340.0130.07019.14
5.4.320.0100.07719.23
5.4.310.0070.07718.98
5.4.300.0100.07718.95
5.4.290.0130.06319.24
5.4.280.0100.07718.99
5.4.270.0070.06019.03
5.4.260.0030.08319.00
5.4.250.0070.05018.97
5.4.240.0000.05319.09
5.4.230.0130.06719.00
5.4.220.0130.06718.98
5.4.210.0030.07719.00
5.4.200.0030.08019.00
5.4.190.0100.07719.02
5.4.180.0070.07719.00
5.4.170.0130.06319.07
5.4.160.0200.06318.99
5.4.150.0100.06318.97
5.4.140.0030.07716.52
5.4.130.0130.04716.44
5.4.120.0270.03016.62
5.4.110.0030.07016.41
5.4.100.0130.07016.59
5.4.90.0100.06316.66
5.4.80.0130.07016.69
5.4.70.0200.05016.59
5.4.60.0070.07016.39
5.4.50.0030.06716.50
5.4.40.0070.06316.52
5.4.30.0030.06716.33
5.4.20.0030.07316.62
5.4.10.0030.07316.45
5.4.00.0070.06715.77
5.3.290.0070.07714.69
5.3.280.0030.07714.74
5.3.270.0030.07314.62
5.3.260.0130.06714.64
5.3.250.0100.07014.61
5.3.240.0070.07314.75
5.3.230.0100.07314.69
5.3.220.0030.07314.57
5.3.210.0070.08014.71
5.3.200.0030.08014.54
5.3.190.0100.07714.55
5.3.180.0030.08014.59
5.3.170.0070.07714.61
5.3.160.0070.06714.68
5.3.150.0130.05314.55
5.3.140.0130.06714.57
5.3.130.0100.06714.68
5.3.120.0100.07014.56
5.3.110.0070.06014.56
5.3.100.0200.02714.18
5.3.90.0100.07013.99
5.3.80.0030.07314.02
5.3.70.0100.05014.05
5.3.60.0000.05014.16
5.3.50.0130.06713.99
5.3.40.0100.07014.09
5.3.30.0070.06713.99
5.3.20.0100.07013.66
5.3.10.0070.07013.67
5.3.00.0070.07013.64
5.2.170.0000.04712.43
5.2.160.0100.05712.43
5.2.150.0030.03312.43
5.2.140.0000.06712.43
5.2.130.0030.06312.43
5.2.120.0000.06012.43
5.2.110.0070.05012.43
5.2.100.0070.03312.43
5.2.90.0000.06012.43
5.2.80.0030.06312.43
5.2.70.0000.06712.43
5.2.60.0000.06012.43
5.2.50.0030.04312.43
5.2.40.0070.05712.43
5.2.30.0030.06012.43
5.2.20.0000.04712.43
5.2.10.0070.05712.43
5.2.00.0030.06012.43
5.1.60.0030.05712.43
5.1.50.0030.05312.43
5.1.40.0000.05312.43
5.1.30.0030.05312.43
5.1.20.0100.04312.43
5.1.10.0070.04712.43
5.1.00.0030.06012.43
5.0.50.0070.04012.43
5.0.40.0000.05012.43
5.0.30.0000.06712.43
5.0.20.0030.04712.43
5.0.10.0070.04012.43
5.0.00.0000.06312.43
4.4.90.0030.03312.43
4.4.80.0100.02312.43
4.4.70.0000.03712.43
4.4.60.0030.03312.43
4.4.50.0000.03712.43
4.4.40.0000.05712.43
4.4.30.0000.03712.43
4.4.20.0000.02312.43
4.4.10.0130.02312.43
4.4.00.0030.03312.43
4.3.110.0000.02712.43
4.3.100.0000.03312.43
4.3.90.0000.03712.43
4.3.80.0070.03712.43
4.3.70.0000.02012.43
4.3.60.0000.03712.43
4.3.50.0070.03312.43
4.3.40.0030.02712.43
4.3.30.0000.03712.43
4.3.20.0000.04012.43
4.3.10.0070.02712.43
4.3.00.0000.02312.43

preferences:
53.74 ms | 401 KiB | 5 Q