Spike 02 — JS Monte Carlo Baseline

Day 1: pure-JS Monte Carlo kernel in a plain Web Worker, under a strict CSP (no 'unsafe-eval', no 'wasm-unsafe-eval', no third-party origins). The kernel is a seedable pi-by-sampling function — deterministic given seed. See PLAN.md.

Idle.

Tasks

The first task (trivial) is dispatched automatically when the worker reports ready — this is what populates t4/t5. The Re-run / Run buttons measure steady-state task latency after cold-start. Same seed + same params returns an identical result; the _bits field in each result is the hex Float64 IEEE 754 bit pattern, for bitwise cross-engine comparison (Day 2's load-bearing measurement per ADR-0006 §Decision item 7).

postMessage RTT probe (Day 2 threshold #8)

Runs count trivial tasks two ways: (a) unbatched — one postMessage per task, awaiting each result before dispatching the next — and (b) batched — single postMessage of count; worker runs the loop internally. The difference is the per-dispatch postMessage round-trip floor, which sets the smallest task size worth dispatching one-at-a-time in the submitter SDK. Threshold: unbatched mean <1 ms = pass; >5 ms = SDK must default to batching.

Timings (this run)

Markert (ms from t0)
t0 — embed eval start
t1 — worker created
t2 — worker module top-level eval
t3 — worker reports ready
t4 — first task dispatched
t5 — first task result

End-to-end

Result

For cold-cache measurements always use a fresh incognito window per run. Open DevTools first with throttling configured and "Disable cache" ticked, then navigate. Closing and reopening a normal window is not sufficient (Spike 01 Day 1 finding).