Chez Phase 1 close-out: truthy? elision + end-to-end compute bench (jolt-nkcb)

Elide the redundant jolt-truthy? wrapper on an :if test that provably
yields a Scheme boolean (a native comparison/not, or a boolean const).
Sound because jolt-truthy? of #t/#f is identity. The hot fib/mandelbrot
tests are all comparisons, so this is a direct ceiling lever: fib(30)
end-to-end 24.0 -> 14.4 ms.

Add bench-pipeline.janet (JOLT_CHEZ_BENCH=1, opt-in) timing fib(30) +
mandelbrot(200) through the real pipeline vs the spike ceiling.
Mandelbrot 200 runs at 87 ms, at/below the 98 ms generic-flonum ceiling
- the substrate ceiling is reached end-to-end. fib sits at 2x its
hand-flonum ceiling; the residual is jolt's all-double number model
(typed fl*/fx* emission is Phase 4). Compile-only is total for the
compute subset (every form emits; Chez has no interpreter fallback).

Full parity unchanged at 1534/2494, 0 new divergences.
This commit is contained in:
Yogthos 2026-06-18 09:05:54 -04:00
parent af680ed106
commit e98afcad13
5 changed files with 181 additions and 4 deletions

View file

@ -84,6 +84,28 @@ is clearly worse: ~2.5x Janet's fixed footprint. Trades RAM for speed.
- **Size: fine** (~1.3-1.8x base, ~2-3x full; single-digit MB).
- **Memory: the cost** (~2.5x fixed baseline).
## Phase 1 — real-pipeline measurement (2026-06-18)
The numbers above are hand-translated Scheme (the substrate ceiling). Phase 1
(jolt-cf1q.2) ran the SAME benches end to end through the real pipeline (Clojure
source -> Janet-hosted analyzer -> IR -> Scheme emitter -> Chez compile), timed
in-process (`test/chez/bench-pipeline.janet`, Chez startup excluded):
| bench | real pipeline | ceiling (this run) | gap = Phase 4 lever |
|---------------------|---------------|---------------------------|---------------------|
| fib 30 (flonum) | 14.4 ms | 7.1 ms hand-flonum | 2.0x dispatch/var |
| fib 30 (vs fixnum) | 14.4 ms | 5.2 ms fixnum | all-double model |
| mandelbrot 200 | 87.3 ms | 98.1 ms generic-flonum | AT/below ceiling |
| mandelbrot 200 typed| 87.3 ms | 13.4 ms typed fl*/fx* | typed emit (Phase 4)|
Findings: (1) **compile-only is total** for the compute subset — every form
emits, no interpreter fallback (Chez has none). (2) Mandelbrot through the real
pipeline runs AT the generic-flonum ceiling (87 vs 98 ms) — the substrate ceiling
is reached end-to-end. (3) The fib residual is jolt's all-double number model
(the spike's 5.2 ms fib is fixnum); closing it to the 13.4 ms / fixnum ceiling is
the typed fl*/fx* emission Phase 4 owns. Eliding the redundant `jolt-truthy?`
wrapper on boolean-test `if`s (jolt-nkcb) cut fib 24.0 -> 14.4 ms.
## NOT yet measured (needs the RT port — the real project, not a spike)
- collections / binary-trees: these hit persistent collections + GC. Chez's GC