Related posts
- clang, PHP 8.4 and the missing zlib: the last round of compiled PHP
The final round of the compiled-PHP question: CentminMod's function alignment on its own, a clang build and PHP 8.4, with every module compiled from source. clang is the only build with a repeatable edge (+3 % on XenForo), 8.4 is slower than 8.5, and my earlier source builds were missing zlib.
- Compiling Valkey, and the BOLT flag that gave my binaries an executable stack
Valkey from source was 35 % slower until I stopped passing CFLAGS on make's command line. Then its unit refused the BOLTed binary, which exposed an executable stack in my compiled PHP and Angie too. Plus nginx vs Angie, compiled the same way.
- Everything on: LTO, PGO and -march=native made PHP 8.5 slower
A follow-up to the four-build PHP test: turn on every CentminMod compiler option, add LTO and two-stage PGO trained on real XenForo traffic, and compile every module from source. The result is 5 to 10 % slower than the distribution package, not faster.
My setup script builds PHP from php.net source, any series from 8.1 up. That makes a fair version test easy for once. Every series gets the same compiler, the same flags, the same extensions and the same pool, so the PHP version is the only thing left that differs.
The question is the obvious one for a forum operator: does upgrading XenForo’s PHP still buy speed, and from which version on?
The setup#
Four tiers, each checked for HTTP 200, a page marker and the expected cache status before a run counts:
Each tier ran at two loads:
wrk -c100(saturated) and-c8(no queue). There were 5 rounds, with the arm order reversed every other round, and a cold restart of PHP-FPM on each switch. The figures are the median of the rounds, with min-max spread.Results#
Requests per second at 100 connections, change against PHP 8.1 in brackets:
Every PHP row had a spread under 1.6 %, and no request failed. The c8 runs gave the same order and nearly the same gaps: 8.5 and 8.6 were +8 to +11 % over 8.1, and 8.2 to 8.4 were +4 to +7 %.
PHP-FPM CPU time per request says the same thing without depending on throughput:
What it means#
So for XenForo on this hardware: PHP 8.5 is the version to run, about 10 % faster than 8.1 on pages PHP renders. Anything from 8.2 to 8.4 is a middle step.
Caveats#
--optimizeunder load. An earlier test measured a BOLT-optimised build 5-10 % faster than Sury’s package on logged-in XenForo pages, so production numbers should sit above these.The harness is in the setup script’s repository under
tests/bench-php-matrix/(install-php-series.sh,bench-xf-php-series.sh), along with the raw results.