Run Whisper in a worker thread; shorten polling

The speech model now lives in a worker thread (whisperWorker.mjs), so
loading and transcribing no longer block the bridge's HTTP server or its
Hermes polling. Measured longest event-loop pause during transcription:
387 ms before, 3 ms after. A dead worker is replaced on the next request;
closing the bridge terminates it.

Polling: bridge to Hermes every 150 ms (was 500). The app polls the bridge
every 200 ms for the first 8 s of a turn, 400 ms until 30 s, then 1 s
(was a fixed 700 ms).

Tests: 131 unit/integration, 7 real-speech, 9 real-Hermes, 6 simulator,
all passing. Effect on a phone or a droplet is not measured.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Dan
2026-11-18 18:39:28 -08:00
co-authored by Claude Fable 5.2
parent 6d74f9e121
commit 0c9dcd864f
14 changed files with 212 additions and 31 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ weights:
| 11 s of speech, process pinned to one core | about 1.7 s |
| Same, `whisper-tiny` | about 1.2 s, about 0.6 GB |
| Model download on first start | about 80 MB (`base`), cached afterwards |
| Longest pause of the bridge's event loop while transcribing | about 0.4 s |
| Longest pause of the bridge's event loop while transcribing | 3 ms (the model runs in a worker thread) |
Pinning to one core made no difference to speed, so extra cores will not help; a single droplet
vCPU is the relevant unit. **A shared droplet vCPU is slower than that desktop core by an amount