[php-src] PR #23189: Optimize var_export
| From: | kamil-tekiela | Date: | Sun, 09 Aug 2026 14:55:04 +0000 |
| Subject: | [php-src] PR #23189: Optimize var_export | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-37708@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/23189
Author: kamil-tekiela
The first commit replaces
sprintf with memset.
The second commit replaces php_addcslashes and php_str_to_str with a
custom function based on the smart_str_append_escaped function from zend_smart_str.c.
At one of the 3 call sites, the php_str_to_str was absent, and I didn't know what
to do, which is why I added the flag. This makes the most sense to me, but I could also make it
separate from the new function.
I don't know whether buffer_append_spaces should have inline or not.
I assume it shouldn't.
In my simple round of testing, this proved to make var_export 3x faster.