LearnNewsExamplesServices
Frontmatter
id8995
titleperf: Increase Grid ScrollManager throttle to prevent worker message flooding
stateClosed
labels
bugaiperformancecore
assigneestobiu
createdAtFeb 5, 2026, 12:59 AM
updatedAtFeb 5, 2026, 1:06 AM
githubUrlhttps://github.com/neomjs/neo/issues/8995
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtFeb 5, 2026, 1:06 AM

perf: Increase Grid ScrollManager throttle to prevent worker message flooding

Closed v12.0.0 bugaiperformancecore
tobiu
tobiu commented on Feb 5, 2026, 12:59 AM

Context The Neo.grid.ScrollManager currently uses a 10ms throttle for syncGridBody. This is extremely aggressive (targeting 100fps) and exceeds the standard browser frame rate of 60fps (~16ms).

Problem In heavy components like the Grid, a 10ms update frequency floods the message queue between the App Worker, VDom Worker, and Main Thread. This causes a backlog of updates, resulting in severe input lag (1.5 - 2s) during diagonal scrolling, as the Main Thread struggles to catch up with the worker's output ("Death Spiral").

Solution Increase the throttle timer to 48ms (approximately 20fps). This provides a safe buffer for the worker communication pipeline to clear, ensuring responsive updates without queue flooding.

Validation User testing confirmed that 48ms eliminates the lag and makes updates feel "instant".

Proposed Change Update src/grid/ScrollManager.mjs:

syncGridBody: {type: 'throttle', timer: 48}
tobiu assigned to @tobiu on Feb 5, 2026, 12:59 AM
tobiu added the bug label on Feb 5, 2026, 12:59 AM
tobiu added the ai label on Feb 5, 2026, 12:59 AM
tobiu added the performance label on Feb 5, 2026, 12:59 AM
tobiu added the core label on Feb 5, 2026, 12:59 AM
tobiu
tobiu Feb 5, 2026, 1:05 AM

Input from Gemini 3 Pro:

✦ I have analyzed the bottleneck and applied the fix.

The Bottleneck: The 10ms throttle targets a theoretical 100fps update rate. However, the browser's Main Thread typically runs at 60fps (16.6ms per frame). In a worker-based architecture like Neo.mjs, the round-trip latency (AppWorker -> VDomWorker -> MainThread) adds overhead.

Sending updates every 10ms floods the message queue faster than the Main Thread can process and render them. This creates a backlog of obsolete frames. The 1.5 - 2s lag you experienced is the system churning through this backlog ("Death Spiral").

The Fix: Increasing the throttle to 48ms (approx 20.8fps) ensures that the worker pipeline has enough "breathing room" to process, diff, and render a frame before the next one is queued. This eliminates the backlog and results in the "instant" feel you observed.

I have updated src/grid/ScrollManager.mjs to use timer: 48.

tobiu closed this issue on Feb 5, 2026, 1:06 AM
tobiu referenced in commit 793c341 - "perf: Increase Grid ScrollManager throttle to prevent worker message flooding (#8995)" on Feb 5, 2026, 1:32 AM