[GIT-PULLS] [php-src] PR #23504: [intl] Size sortWithSortKeys buffers based on array size
[email protected] (iliaal)
| Newsgroups | php.git-pulls |
|---|---|
| Message-ID | <[email protected]> |
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.