lumbda/wasm/dist-repl
russell@unturf.com f66124b0bc
streaming: wall-clock flush so low-rate emissions appear immediately
Worker batching used to wait for 64KB / 4096 newlines before
flushing. A program like

  (let loop ((n 0))
    (when (zero? (modulo n 10000))
      (display "Emitted at iteration: ") (display n) (newline))
    (loop (+ n 1)))

emits ~25 bytes every 10K iterations, so the user saw nothing for
several seconds — fox reported "this used to work and doesn't seem
to anymore" because the first emission was buried in the batch
buffer.

Added a 100ms wall-clock check alongside the existing size /
newline thresholds. The first chunk to arrive triggers a flush
(lastFlushTime starts at 0), and low-rate streams cap at ~10
flushes/sec. High-rate streams still hit the byte / newline ceilings
first so chunk batching for tight (display) loops is unaffected.

Verified headlessly: the infinite-emitter program now shows the
first emission within a frame, subsequent ones streaming live as
the loop iterates.
2026-06-15 20:19:39 -04:00
..
asm asm streaming: recycle the 64 KB output buffer after each flush 2026-06-15 06:36:00 -04:00
c repl: auto-pause + portal-save when leaving a tab mid-eval, resume on return 2026-06-15 09:02:53 -04:00
fonts/chunkfive repl: /repl/ page with encrypted multi-tab sessions 2026-06-14 12:50:35 -04:00
python python tier: SAB-backed pause poll — auto-pause now works on python too 2026-06-15 11:16:50 -04:00
crypto.js repl: /repl/ page with encrypted multi-tab sessions 2026-06-14 12:50:35 -04:00
index.html repl: ⏸ pause button — manual snapshot mid-eval without leaving the tab 2026-06-15 11:20:57 -04:00
lumbda-logo-green.png repl: /repl/ page with encrypted multi-tab sessions 2026-06-14 12:50:35 -04:00
repl.css repl: ⏸ pause button — manual snapshot mid-eval without leaving the tab 2026-06-15 11:20:57 -04:00
repl.js repl: fix cancel + immediate-resubmit race that wedged the new eval 2026-06-15 14:11:55 -04:00
runner.js repl: auto-pause + portal-save when leaving a tab mid-eval, resume on return 2026-06-15 09:02:53 -04:00
style.css repl: portal save/resume — vault-backed tier checkpoints 2026-06-15 07:43:07 -04:00
worker.mjs streaming: wall-clock flush so low-rate emissions appear immediately 2026-06-15 20:19:39 -04:00