Skip to content
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

perf: simple simdjson solution with 30% speed increase #7316

Merged
merged 19 commits into from
Jan 28, 2021
Merged

Conversation

karlmcguire
Copy link
Contributor

@karlmcguire karlmcguire commented Jan 15, 2021

This is a much simpler version of #7315 with reasonable speed improvement.

I've made FastParseJSON the default JSON parser (replacing encoding/json) and if simdjson.SupportedCPU() returns false we fallback to encoding/json.

NOTE: This shouldn't be merged until simdjson-go merges this PR fixing number parsing issues. I'm in contact with the maintainer and it should be merged this weekend. If not, we can fork.


This change is Reviewable

@karlmcguire karlmcguire added area/parsing Issues related to the parser or lexer. area/performance Performance related issues. optimization labels Jan 15, 2021
@netlify
Copy link

netlify bot commented Jan 15, 2021

Deploy preview for dgraph-docs ready!

Built with commit 06cb2f8

https://deploy-preview-7316--dgraph-docs.netlify.app

Copy link
Contributor

@manishrjain manishrjain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 4 of 4 files at r3.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @vvbalaji-dgraph)

@karlmcguire
Copy link
Contributor Author

karlmcguire commented Jan 21, 2021

The only remaining issue is passing this test expecting an overflow error from a JSON number which just so happens to be the exact same number from Jepsen's 2018 analysis of Dgraph where the number automatically gets converted into a float64.

Unfortunately simdjson-go doesn't have dec.UseNumber() like encoding/json does, which tells the parser to preserve numbers. This means we'll have to fork simdjson-go.

@karlmcguire karlmcguire merged commit 2a48291 into master Jan 28, 2021
@karlmcguire karlmcguire deleted the karl/json branch January 28, 2021 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/parsing Issues related to the parser or lexer. area/performance Performance related issues. optimization
Development

Successfully merging this pull request may close these issues.

3 participants