Test "perf/shift-cascade"
Expected: 👍 accept · Size: 256.3 KB · Lines: 5.1 k · lean4export: 3.1.0 · Lean: 4.34.1 · Timeout: 50.0 s · 📄 Declaration · 🔗 Source
Stress test for cascading substitution overhead in kernel let processing.
N nested let bindings inside a lambda, where each value references the
outer lambda parameter and the previous binding:
fun (a : Nat → Nat) => let f₁ := fun x => a x let f₂ := fun x => a (f₁ x) ... let fₙ := fun x => a (fₙ₋₁ x) fₙ 0
The kernel processes each let by substituting the value into the body.
Each value has a free bvar (references a), so substitution under inner
binders creates shifted copies. In a de Bruijn kernel with deferred shifts,
these Shift(val, offset) wrappers accumulate: step k must traverse
through O(k) wrappers from previous steps, giving O(N²) total work.
A locally-nameless kernel substitutes fvars that need no shifting, giving O(N) total.
N=1000 in the Lean source. Increase to stress further.
| Checker | Result | ⏱️ | 🧠 | |||
|---|---|---|---|---|---|---|
| sokonanoda | 👍 | 3 ms | (÷15) | 47.0 MB | (-31%) | |
| mathgraph | 👍 | 4 ms | (÷10) | 52.2 MB | (-24%) | |
| nanoclo | 👍 | 5 ms | (÷10) | 56.4 MB | (-17%) | |
| con-ron | 👍 | 32 ms | (-31%) | 70.7 MB | (+3%) | |
| nanobruijn | 👍 | 260 ms | (×5.7) | 63.1 MB | (-8%) | |
| nanoda | 👍 | 6 ms | (÷7.1) | 3.9 MB | (÷18) | |
| lazylean | 👍 | 88 ms | (+91%) | 33.3 MB | (÷2.0) | |
| con-leche | 👍 | 16 ms | (÷2.8) | 26.6 MB | (÷2.6) | |
| eink0rn | 👍 | 11 ms | (÷4.1) | 26.8 MB | (÷2.5) | |
| official | 👍 | 46 ms | (0%) | 68.3 MB | (0%) | |
| ind-models | 👍 | 120 ms | (×2.6) | 112.1 MB | (+64%) | |
| lean4lean | 👍 | 49 ms | (+6%) | 98.9 MB | (+45%) | |
| tenet | 👍 | 151 ms | (×3.3) | 52.1 MB | (-24%) | |
| tenet-hs | 👍 | 45 ms | (-1%) | 74.1 MB | (+9%) | |
| lean4cobol | 👍 | 143 ms | (×3.1) | 16.8 MB | (÷4.1) | |
| evmlean | 👍 | 9.4 s | (×204) | 300.0 MB | (×4.4) | |
| mini | 👍 | 1.8 s | (×40) | 73.9 MB | (+8%) | |
| overfull | ⌛ | 0 ms | 0 B | |||
| metalean-slow | 🚫 | 14.0 s | 328.2 MB | |||
| tenet-jvm | 👍 | 294 ms | (×6.4) | 81.7 MB | (+20%) | |
| nanoclo-fortran | 👍 | 13 ms | (÷3.5) | 7.6 MB | (÷9.0) | |
| kiota | 👍 | 3.5 s | (×76) | 384.9 MB | (×5.6) | |
| metalean-fast | 👍 | 4.4 s | (×95) | 545.0 MB | (×8.0) | |
| canonical-min | 👍 | 408 ms | (×8.9) | 1.1 GB | (×16) | |
| rpylean | 👍 | 6 ms | (÷7.1) | 14.4 MB | (÷4.7) | |
| vow-lean-kernel | 👍 | 316 ms | (×6.9) | 12.5 MB | (÷5.5) | |
| parse-only | 👍 | 41 ms | (-10%) | 68.0 MB | (0%) |