Skip to content

[MicroPerf] Drop accessibility and attribute-scan closures via ListInline - #20421

Merged
abonie merged 1 commit into
mainfrom
t-gro-accessibility-attr-listinline
Sep 10, 2026
Merged

abonie merged 1 commit into
mainfrom
t-gro-accessibility-attr-listinline

Conversation

@T-Gro

@T-Gro T-Gro commented Sep 2, 2026

Copy link
Copy Markdown
Member

Stacks on #20372 (adds the internal ListInline module). Extends it with exists/forall/tryFind (inline + InlineIfLambda) and routes five hot accessibility / attribute-scan call sites through them, folding the lambda so no per-call FSharpFunc closure is allocated.

Closure allocation removed — dotnet-trace gc-verbose, fsc self-compiling src/Compiler (net11 perf bundle):

closure via before after
IsAccessible ListInline.exists 83.9 MB 0
canAccessFrom ListInline.forall 77.6 MB 0
tryFindEntityAttribByFlag / tryFindValAttribByFlag ListInline.tryFind / exists 18.9 MB 0
total ≈ 180 MB 0

canAccessFromOneOf's closure is folded too.

Deterministic proof — closure classes IsAccessible@, canAccessFrom@, canAccessFromOneOf@, tryFindEntityAttribByFlag@, tryFindValAttribByFlag@ are present in the base FSharp.Compiler.Service.dll and absent after (metadata scan of the emitted assembly). exists/forall/tryFind match List.* semantics (empty → false / true / None, first match preserved); build 0/0.

@T-Gro
T-Gro requested a review from a team as a code owner September 2, 2026 07:29
@github-actions github-actions Bot added the AI-Tooling-Check-Bypassed Tooling check: non-fork PR, not diff-analyzed label Sep 2, 2026
@T-Gro
T-Gro requested a review from abonie September 2, 2026 07:46
@T-Gro T-Gro added the NO_RELEASE_NOTES Label for pull requests which signals, that user opted-out of providing release notes label Sep 2, 2026
@T-Gro
T-Gro force-pushed the t-gro-list-hof-closure-spike branch from 2af10a1 to 2612cfb Compare September 9, 2026 08:54
@github-project-automation github-project-automation Bot moved this from New to In Progress in F# Compiler and Tooling Sep 9, 2026
abonie
abonie previously approved these changes Sep 9, 2026
@T-Gro
T-Gro force-pushed the t-gro-accessibility-attr-listinline branch from 0de618b to beab672 Compare September 9, 2026 10:09
@T-Gro
T-Gro changed the base branch from t-gro-list-hof-closure-spike to main September 9, 2026 12:38
@T-Gro
T-Gro dismissed abonie’s stale review September 9, 2026 12:38

The base branch was changed.

…line

Add inline ListInline.forall/tryFind and route the hot accessibility and
attribute-scan checks through the inline ListInline twins so the predicates
are inlined (InlineIfLambda) rather than allocated as per-call closures.

Rebased onto main after the ListInline base (#20372) merged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 17e33363-3dfc-4cf9-9c44-a64686bd5ad1
@T-Gro
T-Gro force-pushed the t-gro-accessibility-attr-listinline branch from beab672 to bf73bc8 Compare September 9, 2026 12:46
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

⚠️ Release notes required, but author opted out

Warning

Author opted out of release notes, check is disabled for this pull request.
cc @dotnet/fsharp-team-msft

@abonie
abonie merged commit b69ba08 into main Sep 10, 2026
52 checks passed
bartelink pushed a commit to bartelink/fsharp that referenced this pull request Oct 7, 2026
…line (dotnet#20421)

Add inline ListInline.forall/tryFind and route the hot accessibility and
attribute-scan checks through the inline ListInline twins so the predicates
are inlined (InlineIfLambda) rather than allocated as per-call closures.

Rebased onto main after the ListInline base (dotnet#20372) merged.

Co-authored-by: perf-bundle <perf@local>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 17e33363-3dfc-4cf9-9c44-a64686bd5ad1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-Tooling-Check-Bypassed Tooling check: non-fork PR, not diff-analyzed NO_RELEASE_NOTES Label for pull requests which signals, that user opted-out of providing release notes

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants