[MicroPerf] Remove per-node closure allocations in post-inference type checking - #20374
Open
T-Gro wants to merge 1 commit into
Open
[MicroPerf] Remove per-node closure allocations in post-inference type checking#20374T-Gro wants to merge 1 commit into
T-Gro wants to merge 1 commit into
Conversation
T-Gro
force-pushed
the
t-gro-effective-guide
branch
from
August 26, 2026 16:12
1128ed9 to
4dd4440
Compare
T-Gro
force-pushed
the
t-gro-effective-guide
branch
from
August 26, 2026 16:16
4dd4440 to
34cfe1d
Compare
Contributor
|
T-Gro
marked this pull request as draft
August 26, 2026 16:35
T-Gro
force-pushed
the
t-gro-effective-guide
branch
2 times, most recently
from
August 26, 2026 17:45
480eeff to
8495dbf
Compare
The recursive type walk allocated a closure for every relevant type node in three places where List.iter2 / List.exists cannot inline the lambda: the IL-generic instantiation walk, the static-abstract-interface type-argument check (#19184), and its interface-constraint predicate. Add ListInline.iter2 / ListInline.exists (inline + InlineIfLambda cursor loops) so the lambda is inlined into a direct loop and no closure is allocated even when it captures per-call state, and use them at the three sites. Same diagnostics in the same order; --deterministic+ self-compile is byte-identical to the base build. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c1cfa10a-2667-4f34-b9ad-b9fa29e52156
T-Gro
force-pushed
the
t-gro-effective-guide
branch
from
August 26, 2026 18:09
8495dbf to
8848033
Compare
T-Gro
marked this pull request as ready for review
August 27, 2026 08:13
T-Gro
enabled auto-merge (squash)
August 27, 2026 08:13
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.
The recursive type walk in
CheckTypeAux/CheckTypeDeepallocated a closure for every relevant type node in three places whereList.iter2/List.existscannot inline the lambda: the IL-generic instantiation walk, the static-abstract-interface type-argument check (#19184), and its interface-constraint predicate.ListInline.iter2/ListInline.exists(inline +[<InlineIfLambda>]cursor loops, next to the otherilliblist helpers) inline the lambda into a direct loop, so no closure is allocated even when it captures per-call state.Measured
Closure allocation removed at the three sites, per compilation of a 120-file corpus (dotnet-trace
gc-verbose, sampled; measured as the total over a 7-self-compile trace ÷ 7):CheckTypeDeep@401(IL-genericList.iter2lambda)visitAppTy@713(List.iter2#19184 partial-app)CheckInterfaceType…@648(List.existspredicate)Behaviour unchanged
Same diagnostics in the same order. Under
--deterministic+(sequential) the self-compiled output is SHA-256 byte-identical to the base build, including a byref/inref/byref<Span>/SRTP-inline/IWSAM-static-abstract/System.Voidsource. IWSAM/SRTP (incl. #19184) and byref-interop component tests pass.