[Fusion] Hoist object-invariant resolution out of the per-property lookup - #10076
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR optimizes composite result object property resolution during execution by hoisting object-invariant work (reference resolution, token-type validation, and selection-set lookup) out of the per-property lookup path, reducing repeated guards and metadata decoding in hot loops.
Changes:
- Introduce
CompositeObjectContextto cache per-object lookup context for repeated property resolution. - Add
GetObjectContextAPIs onCompositeResultElement/CompositeResultDocumentto build the cached context once per object. - Update
ValueCompletionto reuse the cached object context while iterating source object properties.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/HotChocolate/Fusion/src/Fusion.Execution/Text/Json/CompositeResultElement.cs | Adds an internal GetObjectContext() that hoists the per-property validity guard to once-per-object. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Text/Json/CompositeResultDocument.TryGetProperty.cs | Adds GetObjectContext(Cursor) and a linear-scan helper to support cached per-object property lookup. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Text/Json/CompositeObjectContext.cs | New struct that encapsulates cached object lookup state and provides TryGetProperty without repeated invariant work. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/ValueCompletion.cs | Switches object property resolution to use the cached CompositeObjectContext during completion. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+42
to
+46
| var propertyIndex = selection.Id - selectionSet.Id - 1; | ||
| var propertyRowIndex = (propertyIndex * 2) + 1; | ||
| var propertyCursor = _objectStartCursor + propertyRowIndex; | ||
| value = new CompositeResultElement(_document, propertyCursor + 1); | ||
| return true; |
This was referenced Jul 13, 2026
This was referenced Jul 20, 2026
chore(deps): Bump HotChocolate.Subscriptions.InMemory from 15.1.14 to 16.5.1
Kuestenlogik/Bowire#506
Merged
This was referenced Aug 1, 2026
This was referenced Aug 10, 2026
Open
Open
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.
No description provided.