[php-src] PR #25444: Zend: Improve integer to string conversion performance

From: Date: Fri, 13 Nov 2026 13:10:28 +0000
Subject: [php-src] PR #25444: Zend: Improve integer to string conversion performance
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-40625@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/25444 Author: adapik Instead of one digit per iteration (% 10, / 10), print two digits at a time from a 200-byte "00".."99" table, and divide by 10000 per loop step. Output is unchanged. It's not a new idea: most of the other programming languages do this trick (Rust, Go, Java, etc.). Numbers up to ~3 digits don't change much, but longer ones get noticeably faster: | workload | 4-8 digits | 15-19 digits | |---|---|---| | implode() | -16..-20% | -20..-24% | | json_encode() | -9..-16% | -31..-37% | | serialize() | -7..-12% | -22..-30% | | (string)$i / echo | -3..-14% | -17..-25% |

« previous php.git-pulls (#40625) next »