[GIT-PULLS] [php-src] PR #23189: Optimize var_export

[email protected] (kamil-tekiela)
Newsgroups php.git-pulls
Message-ID <9ib49DZJXrjfRTgA5ivYkCkbR67uULtOojCKOsKpbTM@main.internal.php.net>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.