Skip to content

optimize semantic_tag::noesc write_string#685

Merged
danielaparker merged 1 commit intodanielaparker:masterfrom
Gudulin-Alexey:perf/json-noesc-append
Mar 4, 2026
Merged

optimize semantic_tag::noesc write_string#685
danielaparker merged 1 commit intodanielaparker:masterfrom
Gudulin-Alexey:perf/json-noesc-append

Conversation

@Gudulin-Alexey
Copy link
Contributor

This change replaces the per-character loop with a single bulk write: sink_.append(sv.data(), sv.length())

When encoding large JSON strings tagged as semantic_tag::noesc, json_encoder currently writes characters one-by-one via sink_.push_back(*it). This is a hot path for payloads dominated by large base64 fields and causes a noticeable regression versus previous versions.
This gives significant improvement on noesc-heavy DOM->string

This change replaces the per-character loop with a single bulk write:
sink_.append(sv.data(), sv.length())
@danielaparker danielaparker merged commit 85d273f into danielaparker:master Mar 4, 2026
37 checks passed
@danielaparker
Copy link
Owner

Thanks for contributing!

@Gudulin-Alexey Gudulin-Alexey deleted the perf/json-noesc-append branch March 5, 2026 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants