feat(simd): use simd-json for deserialization#216
Open
yamafaktory wants to merge 6 commits intomainfrom
Open
Conversation
epage
reviewed
Apr 24, 2023
| async fn read_file(path: impl AsRef<Path>) -> Result<String> { | ||
| async fn read_file(path: impl AsRef<Path>) -> Result<Vec<u8>> { | ||
| let display_path = path.as_ref().display(); | ||
| let mut file = File::open(&path) |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
epage
reviewed
Apr 24, 2023
crates/jql/Cargo.toml
Outdated
Comment on lines
+19
to
+21
| mimalloc = "0.1.36" | ||
| serde_json = { workspace = true } | ||
| simd-json = "0.9.0" |
There was a problem hiding this comment.
Didn't see it mentioned in the PR; how much did this improve performance?
Owner
Author
There was a problem hiding this comment.
That's the missing piece, not tested yet :)
Owner
Author
There was a problem hiding this comment.
I made a small hyperfine shell script comparing the current binary from main and a release build from this branch.
There's definitely some improvement. Ideally this should be tested against a way bigger JSON file.
Benchmark 1: cat /home/yamafaktory/dev/jql/assets/github-repositories.json | jql '|>{"name","full_name"}' > /dev/null
Time (mean ± σ): 597.2 ms ± 12.1 ms [User: 880.7 ms, System: 165.1 ms]
Range (min … max): 569.9 ms … 629.4 ms 100 runs
Benchmark 2: cat /home/yamafaktory/dev/jql/assets/github-repositories.json | /home/yamafaktory/dev/jql/target/release/jql '|>{"name","full_name"}' > /de
v/null
Time (mean ± σ): 555.8 ms ± 13.9 ms [User: 1001.4 ms, System: 130.3 ms]
Range (min … max): 531.7 ms … 648.2 ms 100 runs
Summary
'cat /home/yamafaktory/dev/jql/assets/github-repositories.json | /home/yamafaktory/dev/jql/target/release/jql '|>{"name","full_name"}' > /dev/null' ra
n
1.07 ± 0.03 times faster than 'cat /home/yamafaktory/dev/jql/assets/github-repositories.json | jql '|>{"name","full_name"}' > /dev/null'
Owner
Author
|
For the record, this can't be used yet sadly since there's no way to preserve the order of the keys, see simd-lite/simd-json#270. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on the awesome feedback from @epage here ❤️ !