lean4-htt/src/Lean/Compiler
Henrik Böving 332c1ec46a
perf: specializer a little more courageously (#12239)
This PR reverts a lot of the changes done in #8308. We practically
encountered situations such as:
```
fun y (z) :=
  let x := inst
  mkInst x z
f y
```
Where the instance puller turns it into:
```
let x := inst
fun y (z) :=
  mkInst x z
f y
```
The current heuristic now discovers `x` being in scope at the call site
of `f` and being used under a binder in `y` and thus blocks pulling in
`x` to the specialization, abstracting over an instance.

According to @zwarich this was done at the time either due to observed
stack overflows or pulling in computation into loops. With the current
configuration for abstraction in specialization it seems rather unlikely
that we pull in a non trivial computation into a loop with this. We also
practically didn't observe stack overflows in our tests or benchmarks.
Cameron speculates that the issues he observed might've been fixed
otherwise by now.

Crucial note: Deciding not to abstract over ground terms *might* cause
us to pull in computationally intensive ground terms into a loop. We
could decide to weaken this to just instance terms though of course even
computing instances might end up being non-trivial.
2026-01-30 08:23:15 +00:00
..
IR fix: run @[init] declarations in declaration order (#12221) 2026-01-29 15:32:56 +00:00
LCNF perf: specializer a little more courageously (#12239) 2026-01-30 08:23:15 +00:00
BorrowedAnnotation.lean refactor: module-ize Lean (#9330) 2025-07-25 12:02:51 +00:00
ClosedTermCache.lean fix: closed term cache (#12024) 2026-01-16 12:41:54 +00:00
CSimpAttr.lean chore: remove redundant imports in core (#10750) 2025-10-16 20:27:46 +00:00
ExportAttr.lean chore: rename Substring to Substring.Raw (#11154) 2025-11-16 09:30:04 +00:00
ExternAttr.lean chore: rename String.ValidPos to String.Pos (#11240) 2025-11-24 16:40:21 +00:00
FFI.lean refactor: use String.split instead of String.splitOn or String.splitToList (#11250) 2025-11-19 09:35:19 +00:00
ImplementedByAttr.lean chore: remove redundant imports in core (#10750) 2025-10-16 20:27:46 +00:00
InitAttr.lean fix: run @[init] declarations in declaration order (#12221) 2026-01-29 15:32:56 +00:00
InlineAttrs.lean refactor: use isRecursiveDefinition when validating macro_inline (#12106) 2026-01-22 16:31:34 +00:00
IR.lean feat: use static initializers where possible (#12082) 2026-01-26 11:22:12 +00:00
LCNF.lean chore: remove the LCNF testing framework (#12207) 2026-01-28 10:09:30 +00:00
Main.lean refactor: module-ize Lean (#9330) 2025-07-25 12:02:51 +00:00
MetaAttr.lean chore: shake: fix handling of meta structure etc (#11701) 2025-12-16 16:28:39 +00:00
ModPkgExt.lean fix: symbol name for native boxed declarations in the interpreter (#12095) 2026-01-21 20:38:29 +00:00
NameMangling.lean fix: symbol name for native boxed declarations in the interpreter (#12095) 2026-01-21 20:38:29 +00:00
NeverExtractAttr.lean chore: remove redundant imports in core (#10750) 2025-10-16 20:27:46 +00:00
NoncomputableAttr.lean refactor: module-ize Lean (#9330) 2025-07-25 12:02:51 +00:00
Old.lean refactor: use String.Slice in String.take and variants (#11180) 2025-11-18 16:13:48 +00:00
Options.lean chore: do not set unused Option.Decl.group (#11307) 2025-11-21 16:44:38 +00:00
Specialize.lean chore: remove redundant imports in core (#10750) 2025-10-16 20:27:46 +00:00