From a8a336b0a0902546aab9fe79cd3ffef1514db15a Mon Sep 17 00:00:00 2001 From: Bohdan Triapitsyn Date: Mon, 20 Apr 2026 20:56:24 +0300 Subject: [PATCH] perf: halve stream flush cadence from 60hz to 30hz MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FLUSH_FRAME_MS 16 -> 33. Delta events keep coalescing, just into larger windows. AssistantTextPart already throttles text at 100ms, so the extra granularity produced no visible benefit — just extra store.setState calls and subscriber notifications per second. --- packages/ui/src/sync/event-pipeline.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ui/src/sync/event-pipeline.ts b/packages/ui/src/sync/event-pipeline.ts index 7b7a25e1..77f0636c 100644 --- a/packages/ui/src/sync/event-pipeline.ts +++ b/packages/ui/src/sync/event-pipeline.ts @@ -19,7 +19,7 @@ export type QueuedEvent = { export type FlushHandler = (events: QueuedEvent[]) => void -const FLUSH_FRAME_MS = 16 +const FLUSH_FRAME_MS = 33 const STREAM_YIELD_MS = 8 const RECONNECT_DELAY_MS = 250 const HEARTBEAT_TIMEOUT_MS = 15_000