Spike: localize the mandelbrot 15x floor (jolt-5vsp) (#143)

The jolt-vs-hand-Janet-vs-JVM mandelbrot comparison splits the 15.4x floor
into two layers: a Janet-VM floor (~10.8x JVM, optimal while-loop Janet over
unboxed doubles — only native codegen moves it) plus a ~1.43x jolt loop-
lowering overhead on top. The overhead is entirely the loop/recur -> recursive-
closure-called-per-iteration lowering; hand-Janet written the same way matches
jolt, while a while+var/set version is 1.43x faster. So a cheap backend win
(jolt-v28u) sits above the structural native-codegen lever.

Adds the spike artifacts under bench/ and the results writeup; marks the spike
done in the handoff. No source changes.

Co-authored-by: Yogthos <yogthos@gmail.com>
This commit is contained in:
Dmitri Sotnikov 2026-06-16 16:20:40 +00:00 committed by GitHub
parent 6c3fec6065
commit ae3f9f6e84
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 232 additions and 1 deletions

View file

@ -85,7 +85,16 @@ Every other axis adds structural overhead **on top** of that floor.
(jolt-4x9 element types + jolt-t6r). Helps dispatch. Bounded ceiling (still
bytecode underneath).
## START HERE — the spike (do this before committing to any lever)
## START HERE — the spike (DONE — see results)
**The spike ran 2026-06-16. Results: `docs/foundational-runtime-spike-results.md`.**
Outcome in one line: the 15.4× floor decomposes into a **Janet-VM floor ≈10.8×
JVM** (the dominant ~70%; only native codegen / lever 1 moves it) plus a **jolt
loop-lowering ≈1.43×** on top (cheap backend win — `loop`/`recur` is lowered to a
recursive closure called per iteration; emit Janet `while`+`var`/`set` instead;
bead **jolt-v28u**). Janet numbers are already unboxed (not a lever). Next: the
lever-1 jolt-IR→C spike for one hot fn (confirm Janet's incremental native-module
path first). The original spike instructions are preserved below for context.
**Localize the 15× floor.** Build three `mandelbrot` implementations and compare: