Repository navigation
MOD-18895 - Preallocate JSON objects using field counts to reduce unused capacity #23
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
1d78afd
(Ram usage redusction):
TalBarYakar 91f8ce9
avoid counting every byte in a string
TalBarYakar f0fac2a
use some data structure to prevent double iter to obtain num of field…
TalBarYakar a7e2ecc
Optimize compact object construction and cover edge cases
TalBarYakar a30b821
Fix optional object-buffer pooling failure handling
TalBarYakar 5c2016c
Reduce object capacity growth from 2x to 1.25x
TalBarYakar 7388d79
Moved deserialize_compact_objects into the existing impl IValueDeserSeed
TalBarYakar e99f9d6
add comment to explain the ValueVisitor
TalBarYakar 3df06cf
rename and comments things so the code become clearer
TalBarYakar 1ba5244
Added the InlineObjectEntries type alias and reused it in both places.
TalBarYakar c2d9af0
Avoid growing full objects when replacing existing fields
TalBarYakar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,19 @@ | ||
| #![no_main] | ||
|
|
||
| use arbitrary_json::ArbitraryValue; | ||
| use ijson::IValue; | ||
| use ijson::{IValue, IValueDeserSeed}; | ||
| use libfuzzer_sys::fuzz_target; | ||
| use serde::Deserialize; | ||
|
|
||
| fuzz_target!(|value: ArbitraryValue| { | ||
| let json_string = value.to_string(); | ||
| let mut deserializer = serde_json::Deserializer::from_str(&json_string); | ||
| let _ = IValue::deserialize(&mut deserializer); | ||
| let ordinary = IValue::deserialize(&mut deserializer); | ||
| let mut deserializer = serde_json::Deserializer::from_str(&json_string); | ||
| let buffered = IValueDeserSeed::new(None).deserialize_compact_objects(&mut deserializer); | ||
| match (ordinary, buffered) { | ||
| (Ok(ordinary), Ok(buffered)) => assert_eq!(ordinary, buffered), | ||
| (Err(_), Err(_)) => {} | ||
| _ => panic!("buffered objects changed whether JSON parsing succeeds"), | ||
| } | ||
| }); |
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So its a vector of maps? what each index represents? Maybe a small comment would help
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done