Skip to content

Reduce allocations and telemetry overhead in Fusion execution - #10093

Merged
michaelstaib merged 2 commits into
mainfrom
mst/alloc-telemetry
Jul 11, 2026
Merged

Reduce allocations and telemetry overhead in Fusion execution#10093
michaelstaib merged 2 commits into
mainfrom
mst/alloc-telemetry

Conversation

@michaelstaib

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings July 11, 2026 20:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces per-node allocation and telemetry overhead in the Fusion execution pipeline by making ExecutionNodeResult a value type and short-circuiting telemetry capture when telemetry collection is disabled.

Changes:

  • Convert ExecutionNodeResult from a reference type to a readonly record struct to avoid allocations.
  • Guard activity/timing capture in ExecutionNode.ExecuteAsync behind context.CollectTelemetry.
  • Update ExecutionState.TryDequeueCompletedResult to return a non-nullable ExecutionNodeResult, and add focused execution-state/telemetry unit tests.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Execution/ExecutionNodeCompletionTests.cs Adds coverage for telemetry gating, single-completion behavior across outcomes, dependent scheduling, and merge-failure application with struct results.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/ExecutionNodeResult.cs Switches ExecutionNodeResult to a readonly record struct to reduce allocations.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/ExecutionNode.cs Skips Activity.Current and timestamp work when telemetry is disabled.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/ExecutionState.cs Adjusts dequeue API to match the non-nullable struct result type.
Comments suppressed due to low confidence (1)

src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/ExecutionNode.cs:122

  • When telemetry collection is disabled, GetTransportDetails will always return (null, null) but this still performs an extra method call and redundant CollectTelemetry check. Since you already have collectTelemetry here, you can avoid the call entirely on the hot path when telemetry is off.
                error,
                context.GetDependentsToExecute(this),
                context.GetSkippedDefinitions(this),
                context.GetVariableValueSets(this),
                context.GetTransportDetails(this));

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

github-actions Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Patch coverage

100.0% of changed lines covered (4/4)

File Covered Changed Patch %
…/Fusion/src/Fusion.Execution/Execution/Nodes/ExecutionNode.cs 4 4 100.0% 🟢

Project coverage: 53.4% (227760/426465 lines)

@michaelstaib
michaelstaib merged commit b129537 into main Jul 11, 2026
6 of 7 checks passed
@michaelstaib
michaelstaib deleted the mst/alloc-telemetry branch July 11, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants