Serial update queue saturation with concurrent $set in Svelte components
0 reputation · 21 Oct 2024, 01:57 UTC
Under concurrent updates, Svelte components that call $set in quick succession appear to be processed through a serial update queue. The design also schedules tick() callbacks as sequential microtasks after DOM updates. The behavior is documented for Svelte 4.x and may differ in Svelte 5.x or custom builds.
The current implementation does not expose a configuration flag to switch from serial processing to a batched update model. There is also an open design question about whether pending tick() promises should be cancellable or coalesced when multiple calls are queued.
Is the serial queue behavior intended for all component trees, or is batching considered for future releases? Should tick() be made cancellable or coalesced to reduce microtask overhead under high concurrency? What is the supported approach for reasoning about latency when many components update simultaneously?