Skip to content

Commit f4a2bc9

Browse files
committed
Optimize JSON string encoding
There are a couple of optimizations that work together: - We now use the specialized php_next_utf8_char_mb() helper function to avoid pressure on the µop and instruction cache. - It no longer emits UTF-8 bytes under PHP_JSON_UNESCAPED_UNICODE until it actually has to. By emitting in bulk, this improves performance. - Code layout tweaks * Use a specialized php_json_append() and assertions to avoid allocating the initial buffer, as this is already done upfront. * Factor out the call to smart_str_extend() to above the UTF-16 check to avoid code bloat. - Use SIMD, either with SSE2 or SSE4.2. A resolver is used when SSE4.2 is not configured at compile time.
1 parent 27a1bec commit f4a2bc9

File tree

1 file changed

+314
-89
lines changed

1 file changed

+314
-89
lines changed

0 commit comments

Comments
 (0)