Commit 4762d46
committed
Avoid modulo operation in loop in array_chunk
For this benchmark:
```php
$length = 25;
for ($i=0;$i<1000;$i++)
array_chunk(range(0, 10000), $length);
```
On an i7-4790, length=25 speeds up by 1.8x and length=1 by 1.27x.
On an i7-1185G7, length=25 speeds up by 1.08x and length=1 by 1.02x.1 parent 1eadf55 commit 4762d46
1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7046 | 7046 | | |
7047 | 7047 | | |
7048 | 7048 | | |
7049 | | - | |
| 7049 | + | |
7050 | 7050 | | |
7051 | 7051 | | |
| 7052 | + | |
7052 | 7053 | | |
7053 | 7054 | | |
7054 | 7055 | | |
| |||
0 commit comments