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

Optimize json parsing for validation #5181

Merged
merged 2 commits into from
Jul 5, 2024
Merged

Optimize json parsing for validation #5181

merged 2 commits into from
Jul 5, 2024

Conversation

fulmicoton
Copy link
Contributor

No description provided.

Copy link

github-actions bot commented Jun 28, 2024

On SSD:

Average search latency is 0.998x that of the reference (lower is better).
Ref run id: 2374, ref commit: f4e5710
Link

On GCS:

Average search latency is 0.967x that of the reference (lower is better).
Ref run id: 2375, ref commit: f4e5710
Link

@fulmicoton fulmicoton force-pushed the optimize-json-parse branch from fe4e904 to 034839d Compare June 28, 2024 09:29
@fulmicoton fulmicoton requested a review from PSeitz July 2, 2024 07:33
Ok(())
} else {
Err(format!(
"failed to parse datetime `{:?}`: value is larger than i64::MAX",
Copy link
Contributor

Choose a reason for hiding this comment

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

this code is unreachable since as_f64 always succeeds

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't unwrap though, always returning Some is an implementation detail of serde_borrow_json. I'll change the error message.

This uses serde_json_borrow to avoid most allocation,
copying, and inserting in hashmap as we deserialize documents.

Before:
validation is taking 10.25% of the CPU
After
validation is taking 5.9% of the CPU.
@fulmicoton fulmicoton force-pushed the optimize-json-parse branch from ab1d19f to 5e0062c Compare July 5, 2024 00:43
@fulmicoton fulmicoton requested a review from PSeitz July 5, 2024 00:52
@fulmicoton fulmicoton merged commit 0b4f35f into main Jul 5, 2024
4 of 5 checks passed
@fulmicoton fulmicoton deleted the optimize-json-parse branch July 5, 2024 01:10
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