Optimize selection inlining in Fusion query planner#10112
Open
michaelstaib wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR optimizes Fusion’s query planning requirement-selection inlining by avoiding a full syntax-tree rewrite and instead walking only selection-set-bearing nodes (fields and inline fragments), reducing work on hot planning paths.
Changes:
- Refactors
OperationPlanner.InlineSelectionsto rewrite selection sets directly (and exposes it asinternalfor test coverage). - Adds focused tests validating inlining behavior when multiple selection sets share the same target id (including
inlineInternalsemantics). - Aligns benchmark
CorpusPathsnamespace with the rest of the Fusion execution benchmarks.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/OperationPlannerSelectionInliningTests.cs | Adds regression tests for selection-set id merging and inlining semantics. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Planning/OperationPlanner.cs | Refactors selection inlining to a targeted selection-set traversal for performance. |
| src/HotChocolate/Fusion/benchmarks/Fusion.Execution.Benchmarks/CorpusPaths.cs | Updates namespace to match the benchmark project’s established namespace. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+3517
to
3520
| var size = selectionSet.Selections.Count + selectionsToInline.Selections.Count; | ||
| var selections = new List<ISelectionNode>(size); | ||
| selections.AddRange(originalSelectionSet.Selections); | ||
|
|
Contributor
Patch coverage91.1% of changed lines covered (72/79)
Uncovered changed lines (JSON){
"sha": "68d0c5e0f8568a96a02d90a19427a29b35967bcd",
"files": [
{ "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Planning/OperationPlanner.cs", "ranges": [[3459, 3462], [3481, 3481], [3534, 3535]] }
]
}Project coverage: 53.7% (230662/429496 lines) |
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.