php-src/ext/mbstring
Arnaud Le Blanc 4df3dd7679
Reduce memory allocated by var_export, json_encode, serialize, and other (#8902)
smart_str uses an over-allocated string to optimize for append operations. Functions that use smart_str tend to return the over-allocated string directly. This results in unnecessary memory usage, especially for small strings.

The overhead can be up to 231 bytes for strings smaller than that, and 4095 for other strings. This can be avoided for strings smaller than `4096 - zend_string header size - 1` by reallocating the string.

This change introduces `smart_str_trim_to_size()`, and calls it in `smart_str_extract()`. Functions that use `smart_str` are updated to use `smart_str_extract()`.

Fixes GH-8896
2022-07-08 14:47:46 +02:00
..
libmbfl Use fast conversion filters to implement php_mb_ord 2022-06-12 15:24:41 +02:00
tests Merge branch 'PHP-8.1' 2022-06-11 16:32:33 +02:00
ucgendat Optimize mb_str{,im}width for performance 2021-09-29 18:19:01 +02:00
common_codepoints.txt mb_detect_encoding recognizes all letters in Hungarian alphabet 2022-05-25 08:22:07 +02:00
config.m4 Implement fast text conversion interface for ISO-2022-JP-2004 2022-05-28 21:53:36 +02:00
config.w32 Implement fast text conversion interface for ISO-2022-JP-2004 2022-05-28 21:53:36 +02:00
CREDITS
gen_rare_cp_bitvec.php Improve detection accuracy of mb_detect_encoding 2021-10-19 18:05:51 +02:00
mb_gpc.c Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
mb_gpc.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
mbstring.c Declare ext/mbstring constants in stubs (#8798) 2022-06-23 17:34:08 +02:00
mbstring.h php_mb_convert_encoding{,_ex} returns zend_string 2022-05-28 21:53:39 +02:00
mbstring.stub.php Declare ext/mbstring constants in stubs (#8798) 2022-06-23 17:34:08 +02:00
mbstring_arginfo.h Declare ext/mbstring constants in stubs (#8798) 2022-06-23 17:34:08 +02:00
php_mbregex.c Reduce memory allocated by var_export, json_encode, serialize, and other (#8902) 2022-07-08 14:47:46 +02:00
php_mbregex.h Declare ext/mbstring constants in stubs (#8798) 2022-06-23 17:34:08 +02:00
php_onig_compat.h
php_unicode.c Optimize mbstring upper/lowercasing: use fast path in more cases 2021-09-20 11:27:54 +02:00
php_unicode.h Add comments to grouped character properties 2021-08-24 22:09:26 +02:00
rare_cp_bitvec.h mb_detect_encoding recognizes all letters in Hungarian alphabet 2022-05-25 08:22:07 +02:00
unicode_data.h Update Unicode tables to 14.0.0 2021-09-20 09:58:20 +02:00