[php-src] PR #20889: Use fast path in more cases when doing case folding with mb_convert_case
| From: | alexdowad | Date: | Sat, 10 Jan 2026 01:04:58 +0000 |
| Subject: | [php-src] PR #20889: Use fast path in more cases when doing case folding with mb_convert_case | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-34495@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/20889
Author: alexdowad
mbstring's Unicode case conversion is table-driven, using Minimal Perfect Hash tables. However,
for small codepoint values, we bypass the hashtable lookup and just use hard-coded conversion logic
(i.e. adding or subtracting 0x20 from the appropriate ASCII range).
For upcasing and downcasing, we had already optimized the conditional which sends execution down
this fast path, to use the fast path for as many codepoint values as possible. However, for case
folding, this had not been done.
This will give a small performance boost for case-folding Unicode text which includes non-breaking
spaces, symbols like ¥ or ™, or accented Latin characters (used in many European languages).
FYA @youkidearitai @ndossche @cmb69