[php-src] PR #12861: Optimize mb_strcut for text encodings with mblen_table
| From: | alexdowad | Date: | Sun, 03 Dec 2023 20:11:43 +0000 |
| Subject: | [php-src] PR #12861: Optimize mb_strcut for text encodings with mblen_table | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-24404@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/12861
Author: alexdowad
For legacy text encodings where mb_strcut is implemented using an mblen_table (such as the various
SJIS variants), mb_strcut is now ~30% faster on small strings (about 10 bytes). This is because we
are now avoiding an extra, unnecessary copy operation on the output string.
When used on large strings, the difference in performance is negligible, as almost the entire
runtime is spent stepping through the string to find the starting and ending cut points.
@Girgias @nielsdos @youkidearitai