[php-src] PR #23080: configure: disable Apple clang size optimizations that hurt runtime speed
| From: | staabm | Date: | Thu, 06 Aug 2026 11:20:35 +0000 |
| Subject: | [php-src] PR #23080: configure: disable Apple clang size optimizations that hurt runtime speed | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-37579@lists.php.net to get a copy of this message | ||
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)