Skip to content

Add Fusion hot path micro benchmarks - #10156

Open
michaelstaib wants to merge 2 commits into
mainfrom
mst/benchmarks
Open

Add Fusion hot path micro benchmarks#10156
michaelstaib wants to merge 2 commits into
mainfrom
mst/benchmarks

Conversation

@michaelstaib

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings July 28, 2026 08:42

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 pull request adds a suite of BenchmarkDotNet micro-benchmarks targeting Fusion execution hot paths, with baseline-vs-candidate variants and equivalence checks to validate candidate behavior.

Changes:

  • Adds benchmarks for MetaDb row decode elimination / row-carrying enumeration and fused decode paths.
  • Adds benchmarks for reducing repeated selection/type-shape work and child selection-set lookup work.
  • Adds benchmarks for lowering JSON/name scanning and variable serialization overhead on merge paths.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/HotChocolate/Fusion/benchmarks/Fusion.Execution.Benchmarks/SourceEnumeratorRowCarryBenchmark.cs Benchmarks duplicate source row decodes during object/array enumeration and a row-carrying alternative.
src/HotChocolate/Fusion/benchmarks/Fusion.Execution.Benchmarks/SelectionTypeShapeBenchmark.cs Benchmarks per-completion type-shape derivation vs precomputed per-selection shape reads.
src/HotChocolate/Fusion/benchmarks/Fusion.Execution.Benchmarks/SelectionChildMapBenchmark.cs Benchmarks per-property child selection set lookup vs leaf-gated indexed memoization.
src/HotChocolate/Fusion/benchmarks/Fusion.Execution.Benchmarks/PropertyNameLengthPrefilterBenchmark.cs Benchmarks property-name scan with a quoted-length prefilter to avoid unnecessary name reads.
src/HotChocolate/Fusion/benchmarks/Fusion.Execution.Benchmarks/ForwardedVariableBlitBenchmark.cs Benchmarks per-entry forwarded-variable reserialization vs prefix capture + raw splice (“blit”).
src/HotChocolate/Fusion/benchmarks/Fusion.Execution.Benchmarks/CompositeContextFusedDecodeBenchmark.cs Benchmarks redundant composite target row decodes vs fused single-decode context acquisition.
src/HotChocolate/Fusion/benchmarks/Fusion.Execution.Benchmarks/AbstractSelectionSetCacheBenchmark.cs Benchmarks abstract selection-set resolution via operation dictionary vs small copy-on-write cache.
Comments suppressed due to low confidence (1)

src/HotChocolate/Fusion/benchmarks/Fusion.Execution.Benchmarks/SourceEnumeratorRowCarryBenchmark.cs:246

  • This throws InvalidOperationException without a message. If this guard ever trips (e.g., if the benchmark logic drifts), diagnosing the failure will be harder than necessary. Use a message consistent with similar guards elsewhere in these benchmarks (and product code).
        if (snapshot._parent is null || snapshot._row.TokenType != JsonTokenType.StartArray)
        {
            throw new InvalidOperationException();
        }

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

Comment on lines +460 to +464
if (prefix is not null)
{
ArrayPool<byte>.Shared.Return(prefix);
}
}
Comment on lines +886 to +890
private sealed class NoOpObjectPool<T> : ObjectPool<T> where T : class, new()
{
public override T Get() => new();

public override void Return(T obj)
Comment on lines +790 to +794
private sealed class NoOpObjectPool<T> : ObjectPool<T> where T : class, new()
{
public override T Get() => new();

public override void Return(T obj)
Comment on lines +429 to +433
private sealed class NoOpObjectPool<T> : ObjectPool<T> where T : class, new()
{
public override T Get()
{
return new T();
Comment on lines +229 to +232
if (snapshot._parent is null || snapshot._row.TokenType != JsonTokenType.StartObject)
{
throw new InvalidOperationException();
}
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