Commit 3942e87
committed
perf: batch streaming history updates to animation frames
Decouple data ingestion from rendering during streaming. Socket events
still accumulate content on every token (cheap mutation), but the
Svelte reactivity trigger (history.messages assignment) now fires at
most once per requestAnimationFrame (~60fps).
This prevents main thread saturation on high-throughput models (400+
tok/s) and adapts automatically to device capability. Non-streaming
events (done, error, status) flush immediately.1 parent a7bc7a0 commit 3942e87
1 file changed
Lines changed: 36 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
381 | 381 | | |
382 | 382 | | |
383 | 383 | | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
384 | 418 | | |
385 | 419 | | |
386 | 420 | | |
| |||
508 | 542 | | |
509 | 543 | | |
510 | 544 | | |
511 | | - | |
| 545 | + | |
512 | 546 | | |
513 | 547 | | |
514 | 548 | | |
| |||
1546 | 1580 | | |
1547 | 1581 | | |
1548 | 1582 | | |
1549 | | - | |
1550 | | - | |
1551 | 1583 | | |
1552 | 1584 | | |
1553 | 1585 | | |
| |||
1582 | 1614 | | |
1583 | 1615 | | |
1584 | 1616 | | |
| 1617 | + | |
1585 | 1618 | | |
1586 | 1619 | | |
1587 | 1620 | | |
| |||
0 commit comments