[GIT-PULLS] [php-src] PR #23080: configure: disable Apple clang size optimizations that hurt runtime speed
[email protected] (staabm)
| Newsgroups | php.git-pulls |
|---|---|
| Message-ID | <[email protected]> |
Pull Request: https://github.com/php/php-src/pull/23080 Author: staabm disclaimer: this change was generated by claude opus. I have very little experience with php-src development ---- Apple clang enables the AArch64 machine outliner and hot/cold code splitting by default at -O2. Both trade speed for size: the outliner inserts extra bl/ret pairs into hot paths (measured inside the inlined zval destructor loops of zend_array_destroy, among others), and cold-split fragments (4700+ in a default cli build) are compiled for size, which mispredicted branch hints turn into slow hot code. Disabling both speeds up a CPU-bound static analysis workload (PHPStan analysing its own codebase, no opcache) by ~4% wall time on an Apple M-series machine. The flags are added only when the compiler accepts them (-Werror guards against clang's unknown -m flag warnings), so non-Apple toolchains are unaffected. ---- benchmark: run `/Users/staabm/workspace/php-src/sapi/cli/php bin/phpstan clear-result-cache -q && /Users/staabm/workspace/php-src/sapi/cli/php -d memory_limit=450M bin/phpstan -v` after checking out https://github.com/phpstan/phpstan-src/pull/5942 from the git root folder. (on first time phpstan-src checkout you need `composer install` and `make` to prepare the codebase) before this PR: 14,47s 14,87s 14,60s after this PR (3 runs after 2 warmup runs): 13,91s 13,68s 13,86s on macOS 26.6 (25G72)