Skip to content

feat: improve performance of instantiateBetaRevRange#13758

Merged
kmill merged 1 commit into
masterfrom
kmill_instantiateBetaRevRange_eff
May 16, 2026
Merged

feat: improve performance of instantiateBetaRevRange#13758
kmill merged 1 commit into
masterfrom
kmill_instantiateBetaRevRange_eff

Conversation

@kmill
Copy link
Copy Markdown
Collaborator

@kmill kmill commented May 16, 2026

This PR improves Expr.instantiateBetaRevRange to be more efficient in the common case where lambda functions are not being instantiated, and it increases expression sharing in applications.

The motivation is that we would like to use this function more pervasively in elaboration, so that users do not need to write dsimp only as frequently in applications that involve higher-order functions, plus inferType uses it so there is a UX inconsistency when the elaborator is not using it.

This PR improves `Expr.instantiateBetaRevRange` to be more efficient in the common case where lambda functions are not being instantiated, and it increases expression sharing in applications.

The motivation is that we would like to use this function more pervasively in elaboration, so that users do not need to write `dsimp only` as frequently in applications that involve higher-order functions.
@kmill kmill added the changelog-language Language features and metaprograms label May 16, 2026
@github-actions github-actions Bot added toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN labels May 16, 2026
@leanprover-bot leanprover-bot added the builds-manual CI has verified that the Lean Language Reference builds against this PR label May 16, 2026
@leanprover-bot
Copy link
Copy Markdown
Collaborator

leanprover-bot commented May 16, 2026

Reference manual CI status:

@kmill
Copy link
Copy Markdown
Collaborator Author

kmill commented May 16, 2026

!bench

@leanprover-radar
Copy link
Copy Markdown

leanprover-radar commented May 16, 2026

Benchmark results for 15fbdf0 against 803553a are in. There are significant results. @kmill

  • build//instructions: -35.4G (-0.31%)

Medium changes (5✅)

  • build/module/Std.Tactic.BVDecide.Bitblast.BVExpr.Circuit.Impl.Expr//instructions: -1.2G (-1.83%) (reduced significance based on absolute threshold)
  • build/module/Std.Tactic.BVDecide.Bitblast.BVExpr.Circuit.Lemmas.Expr//instructions: -1.5G (-1.47%)
  • elab/big_match//instructions: -72.0M (-0.66%)
  • elab/omega_stress//instructions: -67.7M (-1.70%)
  • elab/simp_bubblesort_256//instructions: -205.8M (-1.93%)

Small changes (188✅, 3🟥)

Too many entries to display here. View the full report on radar instead.

@mathlib-lean-pr-testing mathlib-lean-pr-testing Bot added the builds-mathlib CI has verified that Mathlib builds against this PR label May 16, 2026
@mathlib-lean-pr-testing
Copy link
Copy Markdown

Mathlib CI status (docs):

@kmill kmill added this pull request to the merge queue May 16, 2026
Merged via the queue into master with commit 5dea214 May 16, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

builds-manual CI has verified that the Lean Language Reference builds against this PR builds-mathlib CI has verified that Mathlib builds against this PR changelog-language Language features and metaprograms mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN 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