Spike: native codegen (lever 1) feasibility for jolt-5vsp (#144)

Probes the ceiling and incremental strategy for compiling hot fns to native C,
the only lever that moves the ~10.8x Janet-VM floor the localization spike found.

Native-C mandelbrot (Janet native module) runs ~10-12ms — faster than JVM
Clojure (14.2ms) and ~18-22x faster than jolt's 219ms. The boundary cost is
asymmetric: a bytecode loop calling a C hot-fn 40k times is nearly free (~11ms),
but a C fn calling back into bytecode via janet_call costs ~3.5us/call (~152ms,
no win). So the strategy is leaf-first / whole-hot-cluster compilation, crossing
only at cold edges. A plain cc-built .so (no jpm) loads at runtime via require at
full speed, so the native tier fits jolt's dynamic compile model.

Adds the spike artifacts under spike/native/ and the writeup. Next step is
jolt-ihdp (IR->C for the numeric subset). No source changes.

Co-authored-by: Yogthos <yogthos@gmail.com>
This commit is contained in:
Dmitri Sotnikov 2026-06-16 16:30:17 +00:00 committed by GitHub
parent ae3f9f6e84
commit a2ce6bb5f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 248 additions and 0 deletions

View file

@ -0,0 +1,6 @@
(declare-project
:name "mandel-native-spike")
(declare-native
:name "mandel"
:source ["mandel.c"])