Skip to content

perf: use .local asyncMode for eqnOptionsExt - #13477

Merged
nomeata merged 1 commit into
masterfrom
joachim/eqn-options-async-local
Apr 19, 2026
Merged

nomeata merged 1 commit into
masterfrom
joachim/eqn-options-async-local

Conversation

@nomeata

@nomeata nomeata commented Apr 19, 2026

Copy link
Copy Markdown
Collaborator

This PR fixes a benchmark regression introduced in #13475: eqnOptionsExt
was using .async .asyncEnv asyncMode, which accumulates state in the
checked environment and can block. Switching to .local — consistent
with the neighbouring eqnsExt and the other declaration caches in
src/Lean/Meta — restores performance (the
build/profile/blocked (unaccounted) wall-clock bench moves from +33%
back to baseline). .local is safe here because saveEqnAffectingOptions
is only called during top-level def elaboration and downstream readers
see the imported state; modifications on non-main branches are merged
into the main branch on completion.

Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]

This PR fixes a benchmark regression introduced in #13475: `eqnOptionsExt`
was using `.async .asyncEnv` asyncMode, which accumulates state in the
`checked` environment and can block. Switching to `.local` — consistent
with the neighbouring `eqnsExt` and the other declaration caches in
`src/Lean/Meta` — restores performance (the
`build/profile/blocked (unaccounted) wall-clock` bench moves from +33%
back to baseline). `.local` is safe here because `saveEqnAffectingOptions`
is only called during top-level `def` elaboration and downstream readers
see the imported state; modifications on non-main branches are merged
into the main branch on completion.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@nomeata nomeata added the changelog-language Language features and metaprograms label Apr 19, 2026
@nomeata

nomeata commented Apr 19, 2026

Copy link
Copy Markdown
Collaborator Author

!radar

@nomeata
nomeata enabled auto-merge April 19, 2026 14:36
@leanprover-radar

leanprover-radar commented Apr 19, 2026 •

Copy link
Copy Markdown

Benchmark results for 3cb5bd0 against 1d2cfb4 are in. There are significant results. @nomeata

  • ✅ build//instructions: -3.2G (-0.03%)

Large changes (1✅)

  • ✅ build/profile/blocked (unaccounted)//wall-clock: -43s (-25.38%)

Small changes (2✅)

  • ✅ build/module/Init.Data.Int.Lemmas//instructions: -47.0M (-0.94%)
  • ✅ build/module/Init.Data.List.ToArray//instructions: -84.3M (-0.39%)

@nomeata
nomeata added this pull request to the merge queue Apr 19, 2026
Merged via the queue into master with commit 7cc3a4c Apr 19, 2026
23 checks passed
@github-actions github-actions Bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Apr 19, 2026
@mathlib-lean-pr-testing

Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 1d2cfb47e7f04bac3c384a60e5775ee66ebd3c34 --onto 80cbab16420b90104647a795a18f9890fd8150e8. You can force Mathlib CI using the force-mathlib-ci label. (2026-04-19 15:23:06)

@leanprover-bot

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 1d2cfb47e7f04bac3c384a60e5775ee66ebd3c34 --onto 3fc99eef102549c743c6c63547983319bfae6f01. You can force reference manual CI using the force-manual-ci label. (2026-04-19 15:23:07)

nomeata added a commit that referenced this pull request Apr 21, 2026
This PR fixes a benchmark regression introduced in #13475:
`eqnOptionsExt`
was using `.async .asyncEnv` asyncMode, which accumulates state in the
`checked` environment and can block. Switching to `.local` — consistent
with the neighbouring `eqnsExt` and the other declaration caches in
`src/Lean/Meta` — restores performance (the
`build/profile/blocked (unaccounted) wall-clock` bench moves from +33%
back to baseline). `.local` is safe here because
`saveEqnAffectingOptions`
is only called during top-level `def` elaboration and downstream readers
see the imported state; modifications on non-main branches are merged
into the main branch on completion.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-language Language features and metaprograms toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants