Repository navigation
Avoid useless initializations of fci/fcc in array functions - #18273
Conversation
These cause cache misses due to global access, in phpstan (notably the array_map). Initializing these isn't necessary because ZPP initializes it for us. Only for optional arguments do we need to be careful; for `array_filter` we still reset the `fci` but not `fci_cache` because `fci` is not necessarily set by ZPP but is conditionally used to access `fci_cache`.
See php#18273, a constant may cause unnecessary cache misses.
iluuu1994
left a comment
There was a problem hiding this comment.
Just realized I never actually approved this. I checked all the cases again and this looks correct to me.
|
I guess its related to this PR, therefore posting it here. running phpstan/phpstan-src@b3d3386 on macOS considerable got faster: running 8376904 with
3 runs runtime: vs. running 1684c52a88d with the same command: 3 runs runtime: vs. PHP 8.3.20 (cli) (built: Apr 8 2025 20:21:18) (NTS) 3 runs runtime: vs. PHP 8.4.5 (cli) (built: Mar 12 2025 01:55:56) (NTS) 3 runs runtime: |
|
At least also because of the CALL VM optimization. |
|
Thanks to anyone involved 😎 //cc @arnaud-lb |
These cause cache misses due to global access, in phpstan (notably the array_map).
Initializing these isn't necessary because ZPP initializes it for us. Only for optional arguments do we need to be careful; for
array_filterwe still reset thefcibut notfci_cachebecausefciis not necessarily set by ZPP but is conditionally used to accessfci_cache.