Repository navigation
Compute compilation-wide facts once per edit instead of once per type (S5) - #8532
Merged
Aaronontheweb merged 1 commit intoSep 11, 2026
Conversation
This was referenced Sep 9, 2026
Merged
Aaronontheweb
added this pull request to stack #8531
September 9, 2026 13:28
Aaronontheweb
force-pushed
the
feature/serialization-v2-generator-facts
branch
from
September 9, 2026 13:31
89ab9e9 to
68e2a4c
Compare
This was referenced Sep 9, 2026
Aaronontheweb
force-pushed
the
feature/serialization-v2-generator-facts
branch
from
September 9, 2026 17:14
68e2a4c to
be67858
Compare
Aaronontheweb
force-pushed
the
feature/serialization-v2-generator-facts
branch
from
September 9, 2026 18:08
be67858 to
96f9017
Compare
Aaronontheweb
force-pushed
the
feature/serialization-v2-generator-facts
branch
2 times, most recently
from
September 10, 2026 23:44
56fd382 to
8f64d5f
Compare
…ation; referenced-assembly walk skeleton S5 of the generator architecture pass: - Add CompilationFacts (symbol-free, value-equatable): per protocol key, the sorted local unmarked-implementor list (AKKASG029's input) and a Decision-19 referenced-assembly implementor list (empty for now), plus the sorted list of referenced assemblies that themselves reference Akka.Serialization.V2. - Add the CompilationFacts pipeline stage (context.CompilationProvider.Combine(collected serializers).Select(...), tracking name CompilationFacts) in a new AkkaSerializerGenerator.Facts.cs. The whole-compilation local-implementor walk now runs once per compilation change for every serializer's protocol at once, instead of once per serializer inside the old ValidateProtocolCoverage. - ValidateProtocolCoverage is now a pure function of SerializerInfo + CompilationFacts, with no Compilation parameter; the AKKASG029 coverage output combines ResolvedSerializers with CompilationFacts instead of the raw Compilation. Same diagnostic id/text/trigger conditions. - CompilationFacts is deliberately NOT combined into ResolvedSerializers' own inputs yet: nothing it computes today affects resolve/emission, so wiring it in now would only add equality-risk surface. Documented at TrackingNames.CompilationFacts for when Decision 19's referenced-assembly implementor walk becomes real. - Cache KnownTypes per Compilation instance via a ConditionalWeakTable instead of rebuilding it (about fifteen GetTypeByMetadataName lookups) once per attributed type per compilation change in both attribute transforms. - Add the Decision 19 referenced-assembly walk skeleton: filters referenced assemblies down to those that reference Akka.Serialization.V2 (real), with the implementor enumeration itself returning empty (a follow-up). - Extend TrackingNames.All and the incremental scenario specs with the new stage; add GeneratorCompilationFactsSpec for the facts computation itself. Benchmark (SourceGeneratorBenchmarks, ShortRun, base b441744 vs this branch): Fresh driver, full corpus: 78.47 ms / 21.92 MB -> 20.82 ms / 18.07 MB One field renamed in one message: 65.46 ms / 12.49 MB -> 13.06 ms / 8.64 MB Trailing whitespace/comment edit: 58.98 ms / 6.75 MB -> 8.90 ms / 2.93 MB Unrelated file edited (no-change): 52.80 ms / 6.73 MB -> 6.81 ms / 2.91 MB All 313 Akka.Serialization.V2.Tests pass (309 plus 4 new); GoldenOutput/WireSnapshots/ MessageModelSnapshots unchanged; generator builds with -warnaserror; Akka.Remote builds.
Aaronontheweb
force-pushed
the
feature/serialization-v2-generator-facts
branch
from
September 11, 2026 15:05
8f64d5f to
3e27a51
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. Every keystroke got 4 to 8 times cheaper.
CompilationFacts, computes what the pipeline needs to know about the whole compilation, once per edit, and hands it down as plain values that compare by content. The protocol-coverage check (AKKASG029) reads its result instead of walking every type once per serializer.Two small helpers were needed: an
ImmutableArray<T>compares by reference, so a dictionary whose values are arrays needs a compare that looks inside.Scenarios
Scenario d, a keystroke in an unrelated file, is this PR's pin: the facts stage runs and reports its output unchanged.
Savings
Base is the S4 tip, measured in a paired run on the same machine. This PR's row was measured twice in separate runs: allocations were identical, and means agreed within 5 percent.
The S1 baseline blamed the no-change floor on Roslyn re-running the per-type step. Most of that floor was ours. A keystroke in an unrelated file now costs about 6 ms and 3 MB at 500 messages.
How it was checked
313 tests pass (309 plus 3 facts tests and 1 scenario). Generator builds with warnings as errors.
Akka.Remotebuilds. Golden, wire, and both model snapshots unchanged.