Skip to content

[Fusion] Reduce per-property and per-object work in value completion - #10696

Merged
michaelstaib merged 3 commits into
ChilliCream:mainfrom
michaelstaib:perf/b3-value-completion
Oct 26, 2026
Merged

michaelstaib merged 3 commits into
ChilliCream:mainfrom
michaelstaib:perf/b3-value-completion

Conversation

@michaelstaib

Copy link
Copy Markdown
Member

When the gateway merged subgraph data into the final result, it read the data of every source property several times and went through a large general-purpose helper for every nested object and list. Value completion now walks source objects and arrays with enumerators that read each entry once, calls the object and list paths directly when no errors are involved, and keeps the rarely used error handling out of the hot loop. The produced results are byte for byte the same.

Metric Before Optimization After Optimization
Throughput 4,474 req/s 4,591 req/s (+2.6%)
Latency p50 9.96 ms 9.58 ms
CPU per request 0.812 ms 0.777 ms (-4.3%)
Memory allocated per request 32.5 KB 32.5 KB
Memory usage (avg working set) 162.9 MB 167.4 MB

Measured on the federation benchmark twin machine with the benchmark's deep-recursion query (constant 50 VUs, gateway pinned to 4 logical cores), median of 4 interleaved 60 s runs against main. Throughput differences below about 2% are within run-to-run noise.

Walk source objects and arrays with row-carrying snapshot enumerators, so each
value row is read once instead of again for CreateSnapshot and MoveNext.
Dispatch object and list values straight to TryCompleteObjectValue and
TryCompleteList when there is no error trie, and move error and response-name
mapping paths into separate methods to shrink the hot frames.
Initialize undefined object and array slots without re-reading the slot for
layout tracking, and keep stackalloc out of CreateObject's common path so the
method tiers up with PGO. Results are byte-identical.

(cherry picked from commit f901fb2830fea2af3a8f60c92b9318295d9bb262)
InitializeObject and InitializeArray asserted that the raw token of the target slot
is None. After an @interfaceObject upgrade, a selected field that the stand-in left
undefined is a reference to an undefined slot, so Debug builds failed the assertion
on a valid request. The assertions now check the resolved token; Release behavior is
unchanged. Adds gateway regressions for an object-valued and a list-valued field
completed after the upgrade, and removes comments that explained implementation
details instead of contracts.
@michaelstaib
michaelstaib merged commit c6108f3 into ChilliCream:main Oct 26, 2026
151 checks passed
This was referenced Oct 28, 2026
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.

1 participant