Commit a2149ef
fix(wasm): eliminate UI hang during prompt prefill (#30)
The browser froze for 5-15s after pressing Enter because the prefill
loop (running all prompt tokens through 28 layers) had no yield points.
ASYNCIFY sleep only fired during token generation, not prefill.
Two fixes:
1. quant.h: add emscripten_sleep(0) every 2 tokens in the prefill
loop. Browser can repaint and stays responsive. Only active on
__EMSCRIPTEN__ builds — native is unaffected.
2. index.html: double-requestAnimationFrame before WASM call ensures
"Thinking..." indicator paints before any blocking starts.
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 5f06417 commit a2149ef
4 files changed
+13
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15461 | 15461 | | |
15462 | 15462 | | |
15463 | 15463 | | |
15464 | | - | |
| 15464 | + | |
| 15465 | + | |
| 15466 | + | |
15465 | 15467 | | |
15466 | 15468 | | |
| 15469 | + | |
| 15470 | + | |
| 15471 | + | |
| 15472 | + | |
15467 | 15473 | | |
15468 | 15474 | | |
15469 | 15475 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
448 | 448 | | |
449 | 449 | | |
450 | 450 | | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
451 | 456 | | |
452 | 457 | | |
453 | 458 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
0 commit comments