Repository navigation
Move generic expansion out of the per-keystroke path (S7) - #8538
Merged
Aaronontheweb merged 1 commit intoSep 11, 2026
Conversation
Aaronontheweb
added this pull request to stack #8531
September 9, 2026 13:28
Aaronontheweb
force-pushed
the
feature/serialization-v2-expansion-hoist
branch
from
September 9, 2026 13:32
0d8dce4 to
d3032ad
Compare
This was referenced Sep 9, 2026
Merged
Aaronontheweb
force-pushed
the
feature/serialization-v2-expansion-hoist
branch
from
September 9, 2026 17:15
d3032ad to
fa560cc
Compare
Aaronontheweb
force-pushed
the
feature/serialization-v2-expansion-hoist
branch
from
September 9, 2026 18:08
fa560cc to
d7c0379
Compare
Aaronontheweb
force-pushed
the
feature/serialization-v2-expansion-hoist
branch
from
September 9, 2026 22:52
d7c0379 to
b7e6773
Compare
Aaronontheweb
force-pushed
the
feature/serialization-v2-expansion-hoist
branch
from
September 10, 2026 23:44
b7e6773 to
1b7bf42
Compare
…r transform into a per-compilation stage Decision 18's ManifestPrefix expansion used to walk the compilation's declared types and construct/extract every expanded member inline, inside the per-node serializer extraction transform -- so a project with ManifestPrefix registrations paid that walk and those constructions again on every keystroke, even for edits nowhere near the registration. The transform now only classifies each type-argument position from its own symbol (no walk) and records a light PrefixExpansionSpec. A new per-compilation stage, ComputeClosedGenericExpansions (AkkaSerializerGenerator.Expansion.cs), shares CompilationFacts' own cached closed-set buckets to resolve a discovered position's member set, runs the same cartesian product and manifest formula, and extracts each construction's schema. Its output is merged back into each SerializerInfo (SerializerInfo.WithClosedGenericExpansion) so every other consumer of ClosedGenericRegistrations/ClosedGenericSchemas reads them exactly as before. Getting byte-identical golden output required splicing each registration's expanded members back at the same insertion point F2/F3's inline expansion left them at, and a symbol resolver that recurses through a closed generic candidate's own type arguments (Compilation.GetTypeByMetadataName alone only resolves an open definition). Adds three incremental caching-proof scenarios and a ManifestPrefix corpus variant to SourceGeneratorBenchmarks. Behavior-neutral: no new diagnostic, no changed diagnostic text, no changed generated output for any existing fixture.
Aaronontheweb
force-pushed
the
feature/serialization-v2-expansion-hoist
branch
from
September 11, 2026 15:05
1b7bf42 to
44f9dd2
Compare
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.
What changes
Nothing in output or diagnostics. The
ManifestPrefixexpansion no longer runs inside the serializer's per-keystroke step. F2 and F3 both listed that as their known limit.AllowEmpty. No walk, no type construction, no schema extraction. An invalid target or argument still reports AKKASG040 with the same text and location.What this buys, and what it does not
The walk is gone from the per-keystroke step, and everything downstream stays cached. But the new step still constructs and extracts every expansion on each keystroke before finding its table unchanged, because it needs the compilation and cannot skip. On a serializer that expands over 100 members, that cost remains. The benchmark's new prefix variant makes it visible for the first time.
Removing it needs expansion by substitution over the cached schemas: the definition's schema and each member's schema are already plain values, so a construction's schema can be derived with no symbol at all. That is proposed as S8 on the design page, and it is the step that would make a prefix registration cost nothing per keystroke.
Cost
The benchmark gains a
PrefixVariantswitch: one serializer registersEnvelope<TProtocol>withManifestPrefixover its 100 protocol messages. Base is the F3 tip. Allocations are the reliable column; means at short-run resolution on a shared machine carry error bars wider than these differences.The plain corpus is flat. The prefix variant's no-change rows drop about 8 percent, which is the walk. The 1.3 MB gap that remains between the two corpora on a no-change edit is the construction cost described above.
How it was checked
372 tests pass (369 plus 3 scenarios), three runs in a row. Golden, wire, and both model snapshots byte-identical. Generator and
Akka.Remotebuild with warnings as errors. The design record gains an addendum under Decision 18 saying where the walk went. Local runs usedNuGetAudit=falseduring the restore break that #8535 fixed; nothing of that is committed.