Add Fusion hot path micro benchmarks - #10156
Open
michaelstaib wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
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
InvalidOperationExceptionwithout 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(); | ||
| } |
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.