Repository navigation
Avoid property-name allocations in fast-path JSON readers - #554
Merged
Merged
Conversation
Dispatch on unescaped UTF-8 spans with length and byte discriminators, preserving validation and using stack or pooled buffers for escaped and segmented names. Add regression coverage and refresh the full performance dataset and charts. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #554 +/- ##
==========================================
+ Coverage 94.46% 94.47% +0.01%
==========================================
Files 299 299
Lines 19556 19637 +81
Branches 3820 3797 -23
==========================================
+ Hits 18473 18553 +80
Misses 795 795
- Partials 288 289 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Generated object readers currently allocate a string for every JSON property name before dispatching. This removes those temporary allocations by matching unescaped UTF-8 spans directly.
Approach
Utf8JsonReader.CopyString()with stack or pooled buffers for escaped and segmented names, preserving invalid-text validation.SequenceEqualchecks. Full byte-list patterns did not receive equivalent wide-comparison optimizations in the inspected ARM64 code.Performance
Refresh all 99 measurements, eight charts, and the exported dataset in the performance documentation. Fast-path allocations fall from 576 B to 440 B for the small POCO, from 3.06 KiB to 2.02 KiB for the large POCO, and from 10.80 MiB to 5.73 MiB for the CITM batch.
Separate lookup experiments favored generated UTF-8 dispatch over full byte-list patterns and frozen character/byte alternate lookups for the measured four- and 24-property schemas. Scratch benchmarks are not included in this PR.
Validation
make test: CLR and Native AOT suites passed.git diff --checkpassed.