Transpiler (transpiler.sx): detects CEK state dict literals (5 fields: control/env/kont/phase/value) and emits CekState OCaml record instead of Dict(Hashtbl). Eliminates 200K Hashtbl allocations per page. Bootstrapper: skip stdlib.sx (functions already registered as OCaml primitives). Only transpile evaluator.sx. Runtime: get_val handles CekState with direct field access. type_of returns "dict" for CekState (backward compat). Profiling results (root cause of slowness): Pure eval: OCaml 1.6x FASTER than Python (expected) Aser: OCaml 28x SLOWER than Python (unexpected!) Root cause: Python has a native optimized aser. OCaml runs the SX adapter-sx.sx through the CEK machine — each aserCall is ~50 CEK steps with closures, scope operations, string building. Fix needed: native OCaml aser (like Python's), not SX adapter through CEK machine. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
7.8 KiB
7.8 KiB