Skip to content

Performance degradation for streamed content when escaped strings or unicode characters present #549

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
nikolaydimitrov opened this issue May 22, 2025 · 0 comments

Comments

@nikolaydimitrov
Copy link

We have found that the performance of json.NewDecoder(in).Decode(&out), i.e. when using streamed decoder is very poor.
Compared to json.Unmarshal it is about 80-90x times slower.

Profiling shows that memmove is being called too often and is responsible for 96% of the execution.
These two places are the culprit:

Looking at the code, the problem is that those append (memmove) calls are basically called for every character in the input stream.

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

No branches or pull requests

1 participant