[php-src] PR #23504: [intl] Size sortWithSortKeys buffers based on array size
| From: | iliaal | Date: | Sat, 29 Aug 2026 12:23:19 +0000 |
| Subject: | [php-src] PR #23504: [intl] Size sortWithSortKeys buffers based on array size | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-38198@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/23504
Author: iliaal
collator_sort_with_sort_keys() unconditionally ecalloc'd sortKeyBuf and sortKeyIndxBuf at 1MiB
each, 2MiB per call regardless of array size, which dominates cost for small arrays. Initial sizes
now derive from zend_hash_num_elements(): 32 bytes per key and one index entry per element, clamped
to a 4KiB minimum and capped at the old 1MiB defaults. Large inputs behave as before, and the
unchanged erealloc growth path still covers all keys if the estimate is low.