diff options
author | Tyson Andre <tysonandre775@hotmail.com> | 2019-11-15 21:29:46 -0500 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2019-11-18 11:54:35 +0300 |
commit | 7901913b833fc5cceac72711bf235c8a570e8ac1 (patch) | |
tree | 34a58abe75be39b87c3e4090c3dcc5bbe1b14abf /sapi/apache2handler/php_functions.c | |
parent | 8bf663d3b2e9ff0400c1207acfdc81a7740476c5 (diff) | |
download | php-git-7901913b833fc5cceac72711bf235c8a570e8ac1.tar.gz |
Speed up foreach/FE_FREE (optimize for arrays without gc)
In the case where there are still references to an array being iterated
over when the iterator is freed (or the array is not reference counted):
- There's need to save the opline.
- There's no need to check for exceptions.
```
// Before: 0.404 seconds
// After: 0.362 seconds
// loop_iter_empty(1000, 5000);
function loop_iter_empty(int $a, int $b) {
$values = array_fill(0, $b, []);
$total = 0;
for ($i = 0; $i < $b; $i++) {
foreach ($values as $v) {
foreach ($v as $x) {
$total += $x;
}
}
}
return $total;
}
```
Diffstat (limited to 'sapi/apache2handler/php_functions.c')
0 files changed, 0 insertions, 0 deletions