-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
[Feature]: replace "encoding/json" with a more performant option #18704
Comments
Hopefully long term we can migrate to encoding/json/v2 instead: golang/go#63397 |
in the case of genesis import/export i think a state modifier may be more performant than anything we can do with json. In disaster recovery scenarios a chain would write a short state modifier, since the chain is halted all validators would run the state transition producing a valid state. This is similar to what we have today with store migrations. Ideally this never happens. |
How about bytedance/sonic, it looks like better than json-iterator/go |
sonic is not very cross-platform and does not support go 1.24. They have this ugly log that shows up if you run a binary with it compiled on go 1.24.
Also, these top performance metrics are only applicable if you provide the Can you please drop sonic in favor of a more go native solution? I'm patching in the meantime to get rid of it. I like github.com/goccy/go-json. |
FYI for anyone else wishing to patch this issue, my team forked
Which will remove the sonic dependency in place of go-json. |
That is mainly due to a regression in Go 1.24 -> ref bytedance/sonic#741 |
Summary
The default JSON encoding library is not the most performant.
In Osmosis, we've run into this issue where JSON serialization would be one of the biggest bottlenecks in one of the off-chain services.
Problem Definition
See PR for more context: osmosis-labs/osmosis#7065
Proposed Feature
Replacing to https://github.com/json-iterator/go showed some improvement.
As a result, I'm proposing to evaluate a replacement JSON library in cosmos SDK to see if we can save on serialization in import/export genesis.
The text was updated successfully, but these errors were encountered: