Files
rose-ash/tests
giles 21e6351657
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 55s
HS: batched conformance runner + JIT cache architecture plan
tests/hs-run-batched.js — fresh-kernel-per-batch conformance runner.
Solves the WASM kernel JIT-cache-saturation problem (compiled VmClosures
accumulate over a single process and slow tests at the tail of the run)
by spawning a child Node process per batch. Each batch starts with an
empty cache, so tests at index 1400 perform identically to tests at
index 100. Configurable batch size (HS_BATCH_SIZE, default 150) and
parallelism (HS_PARALLEL, default 1).

This is option 2 from the cache-architecture plan — the lowest-risk fix:
zero kernel changes, deterministic results, runs in the same time as the
single-process version when parallelism matches CPU count.

plans/jit-cache-architecture.md — sketches the SX-wide architectural
fix in three phases:

  1. Tiered compilation — call counter on lambdas; only JIT after K
     invocations. Filters out one-shot lambdas (test harness, dynamic
     eval, REPLs) at the source.
  2. LRU eviction — central cache with fixed budget. Predictable memory
     ceiling regardless of input pattern.
  3. Reset API — jit-reset!, jit-clear-cold!, jit-stats, jit-pin!
     primitives for app-driven cache management.

Layer split: cache datastructure + LRU in hosts/ocaml/lib/sx_jit_cache.ml
(new), VM integration in sx_vm.ml, primitives registered in
sx_primitives.ml, declarative spec in spec/primitives.sx, and SX-level
ergonomics (with-jit-threshold, with-fresh-jit, jit-report) in lib/jit.sx.
This is host-specific to the OCaml WASM kernel but the SX API surface is
shared across all hosted languages (HS, Common Lisp, Erlang, etc.).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 18:41:06 +00:00
..