[php-src] PR #25847: perf: ext/standard: Optimize strtr() array mode bitset and prefix scan
| From: | iliaal | Date: | Fri, 27 Nov 2026 17:44:35 +0000 |
| Subject: | [php-src] PR #25847: perf: ext/standard: Optimize strtr() array mode bitset and prefix scan | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-41130@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25847
Author: iliaal
strtr() with an array of replacements sized its key-length bitset by the input length
and tested every input byte against the set of first bytes. This keeps the bitsets on the stack,
finds candidates with memchr() or a 16-byte SIMD compare when the keys start with 1 to
4 distinct bytes, and skips candidates whose second byte starts no key. That removes most of the
per-byte work. Benchmarks are in the commit message.