[php-src] PR #23605: perf: avoid float formatting in phpdbg's vasprintf fallback
| From: | henderkes | Date: | Mon, 07 Sep 2026 09:29:35 +0000 |
| Subject: | [php-src] PR #23605: perf: avoid float formatting in phpdbg's vasprintf fallback | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-38362@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/23605
Author: henderkes
> Follow-up to [staabm's comment on
> #23604](https://github.com/php/php-src/pull/23604#issuecomment-5568013504).
>
> Format phpdbg's
P_LOG microseconds as
> 0.%06ld00 when PHP supplies the
> vasprintf() fallback. This skips the division and floating-point
> formatting through zend_dtoa().
>
> Keep native vasprintf() unchanged because its
> %.8F output depends on the numeric locale and floating-point
> rounding mode.
>
> Checked all 1,000,000 microsecond values, seconds/message boundaries, C and German locales, and
> all four rounding modes: 8,016,800 exact comparisons each with master NTS and debug ZTS. Both builds
> passed 72 existing phpdbg tests with one expected skip. The native function's disassembly is
> identical before and after.
>
> A formatting-only benchmark using master's
> ap_php_vasprintf() on Linux x86-64 (NTS, GCC
> -O2, eight alternating pairs of 5,000,000 calls, pinned to one CPU)
> went from 1.668 s to 0.588 s, with 48.1% fewer retired user instructions. This excludes the clock
> read and output I/O. P_LOG has no in-tree callers, so this does not
> demonstrate an application-level speedup.