Test "perf/let-ladder"
Expected: 👍 accept · Size: 457.6 KB · Lines: 10.4 k · lean4export: 3.1.0 · Lean: 4.36.0 · Timeout: 40.0 s · 📄 Declaration · 🔗 Source
The declaration to check has type Nat and value
let x₃ := 0; x₃ + (let x₂ := 0; x₂ + (let x₁ := 0; x₁ + (x₃ + (x₂ + (x₁ + 0)))))
shown at n=3: n let bindings, each separated from the next by an addition,
over an innermost sum that names every binding.
Substituting a binding into the body before checking it traverses O(n) nodes at each of the n bindings, for Θ(n²) in time and in allocated nodes. Recording the binding and reading it where the body names it costs O(1) per binding, for Θ(n).
The additions are what keep the bindings apart: a run of adjacent lets could
be opened by a single substitution; not so here.
Nat.add is the only application head, so no beta reduction is involved.
N=2000 in the Lean source.
| Checker | Result | ⏱️ | 🧠 | |||
|---|---|---|---|---|---|---|
| nano-lean | 👍 | 2.75 ms | (÷367) | 51.4 MB | (÷6.4) | |
| gruszka | 👍 | 4.22 ms | (÷239) | 119.3 MB | (÷2.8) | |
| mathgraph | 👍 | 4.31 ms | (÷234) | 39.9 MB | (÷8.3) | |
| sokonanoda | 👍 | 4.15 ms | (÷243) | 39.7 MB | (÷8.3) | |
| pestka | 👍 | 49.4 ms | (÷20) | 63.3 MB | (÷5.2) | |
| kefir | 👍 | 13.0 ms | (÷78) | 15.8 MB | (÷21) | |
| kefir-wasm | 👍 | 267 ms | (÷3.8) | 117.3 MB | (÷2.8) | |
| con-ron | 👍 | 769 ms | (-24%) | 377.4 MB | (+14%) | |
| con-ron-stream | 👍 | 770 ms | (-24%) | 333.2 MB | (+1%) | |
| con-agua | 👍 | 1.02 s | (+1%) | 207.3 MB | (-37%) | |
| nanobruijn | 👍 | 1.66 s | (+65%) | 825.2 MB | (×2.5) | |
| nanoda | 👍 | 700 ms | (-31%) | 306.3 MB | (-7%) | |
| con-leche | 👍 | 475 ms | (÷2.1) | 229.1 MB | (-31%) | |
| pestka-wasm | 👍 | 804 ms | (-20%) | 606.0 MB | (+83%) | |
| official-nightly | 👍 | 455 ms | (÷2.2) | 331.3 MB | (0%) | |
| eink0rn | 👍 | 1.63 s | (+61%) | 555.9 MB | (+68%) | |
| official | 👍 | 1.01 s | 330.2 MB | |||
| ind-models | 👍 | 1.08 s | (+7%) | 345.7 MB | (+5%) | |
| kiota | 👍 | 538 ms | (-47%) | 806.7 MB | (×2.4) | |
| tenet | 👍 | 1.69 s | (+67%) | 330.4 MB | (0%) | |
| tenet-hs | 👍 | 1.91 s | (+90%) | 633.3 MB | (+92%) | |
| logos-kernel | 👍 | 35.7 ms | (÷28) | 48.0 MB | (÷6.9) | |
| evmlean | 🚫 | 8.71 s | 403.2 MB | |||
| mini | 👍 | 1.30 s | (+28%) | 1015.1 MB | (×3.1) | |
| overfull | ⌛ | — | — | |||
| lean4lean | 👍 | 1.01 s | (0%) | 324.8 MB | (-2%) | |
| lean4cobol | 👍 | 17.1 s | (×17) | 420.7 MB | (+27%) | |
| tenet-jvm | 👍 | 1.30 s | (+29%) | 448.9 MB | (+36%) | |
| nanoclo | 👍 | 5.36 ms | (÷188) | 63.4 MB | (÷5.2) | |
| vow-lean-kernel | 👍 | 33.5 s | (×33) | 533.9 MB | (+62%) | |
| canonical-min | ✋ | 417 ms | 1.0 GB | |||
| lazylean | 👍 | 366 ms | (÷2.8) | 36.7 MB | (÷9.0) | |
| rpylean | 👍 | 12.6 ms | (÷80) | 26.6 MB | (÷12) | |
| metalean-slow | 🚫 | 80.6 ms | 70.5 MB | |||
| metalean-fast | ⌛ | — | — | |||
| nanoclo-fortran | 👍 | 21.1 ms | (÷48) | 12.9 MB | (÷26) |