[php-src] PR #12524: Add fast mb_strcut implementation for UTF-16
| From: | alexdowad | Date: | Wed, 25 Oct 2023 20:57:54 +0000 |
| Subject: | [php-src] PR #12524: Add fast mb_strcut implementation for UTF-16 | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-23995@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/12524
Author: alexdowad
Similar to the fast, specialized mb_strcut implementation for UTF-8 in 1f0cf133db, this new
implementation of mb_strcut for UTF-16 strings just examines a few bytes before each cut point.
Even for short strings, the new implementation is around 2x faster. For strings around 10,000 bytes
in length, it comes out about 100-500x faster in my microbenchmarks.
The new implementation behaves identically to the old one on valid UTF-16 strings; a fuzzer was used
to help verify this.
@Girgias @cmb69 @youkidearitai @kamil-tekiela @iluuu1994