🤖 perf: fix shimmer frame drops + use requestIdleCallback for streaming #986
+423
−60
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The
Shimmercomponent was usingmotion/reactwithbackgroundPositionanimation which runs on the main thread, causing significant frame drops during "Thinking" state when the UI is already under load from streaming.Solution
1. GPU-accelerated shimmer via Web Worker
Replaced motion/react with a Web Worker + OffscreenCanvas approach:
2. Adaptive streaming updates via requestIdleCallback
Replaced fixed 32ms debounce timer with
requestIdleCallback:Files Changed
src/browser/workers/shimmerWorker.ts- NEW: Web Worker for off-thread animationsrc/browser/components/ai-elements/shimmer.tsx- Rewritten with canvas + workersrc/browser/stores/WorkspaceStore.ts- requestIdleCallback for delta coalescingGenerated with
mux