Improve C++ JSON parsing performance#4203
Merged
chriche-ms merged 3 commits intoJun 23, 2020
Merged
Conversation
… operator for performance reasons
|
Very neat. Thanks for finding and fixing! Btw do you have actually have a sample card here that you used in the before/after comparisons that you could share? @paulcam206 / @RebeccaAnne what would be a good place to house such a perf scenario test card? Someplace here - source\uwp\PerfApp? Or inthe scenarios folder as a Perf scenario? |
jwoo-msft
approved these changes
Jun 22, 2020
paulcam206
approved these changes
Jun 23, 2020
chriche-ms
added a commit
to chriche-ms/AdaptiveCards
that referenced
this pull request
Jun 24, 2020
… operator for performance reasons (microsoft#4203)
chriche-ms
added a commit
that referenced
this pull request
Jun 30, 2020
… operator for performance reasons (#4203) (#4220) Co-authored-by: Paul Campbell <[email protected]>
rankush
pushed a commit
to rankush/AdaptiveCards
that referenced
this pull request
May 8, 2024
… operator for performance reasons (microsoft#4203)
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.
Related Issue
Resolves #4202
Description
This PR modifies the ParseUtil::GetJsonValueFromString function to improve JSON parsing performance. The replaced code used a stream extraction operator (i.e. >>) to convert the passed string into a Json::Value instance. While this code was straightforward and easy to understand it required the string data to be copied into a stringstream (twice) and then copied back into a string before parsing could begin. The updated code creates a Json::CharReader directly to avoid these copies.
How Verified
The changes mean that the GetJsonValueFromString function goes from being around 10% of CPU samples to 4% of samples when profiling adaptive card parsing and rendering.
Microsoft Reviewers: Open in CodeFlow