Commit 860b11f
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 c3d7610 commit 860b11f
2 files changed
+317
-89
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
457 | 457 | | |
458 | 458 | | |
459 | 459 | | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
460 | 463 | | |
461 | 464 | | |
462 | 465 | | |
| |||
0 commit comments