LearnNewsExamplesServices
Frontmatter
id8576
titleInvestigate 'requestAnimationFrame' violations (55ms+)
stateClosed
labels
bugaiperformance
assigneestobiu
createdAtJan 12, 2026, 4:09 AM
updatedAtJan 12, 2026, 5:53 AM
githubUrlhttps://github.com/neomjs/neo/issues/8576
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 12, 2026, 5:53 AM

Investigate 'requestAnimationFrame' violations (55ms+)

Closed v11.20.0 bugaiperformance
tobiu
tobiu commented on Jan 12, 2026, 4:09 AM

Issue: Following recent core changes, the console is reporting [Violation] 'requestAnimationFrame' handler took 55ms. This indicates a regression in the main thread's rendering performance.

Goal:

  1. Investigate src/Main.mjs and src/main/DeltaUpdates.mjs to identify bottlenecks.
  2. Instrument the code with performance logging (console.time/timeEnd or performance.now()) to isolate the slow operations.
  3. Analyze the logs to determine if the issue is in VDOM parsing, DOM patching, or message handling.
tobiu added the bug label on Jan 12, 2026, 4:09 AM
tobiu added the ai label on Jan 12, 2026, 4:09 AM
tobiu added the performance label on Jan 12, 2026, 4:09 AM
tobiu referenced in commit 36c5c40 - "perf(DeltaUpdates): Implement DocumentFragment batching for contiguous insertNode operations (#8576)" on Jan 12, 2026, 5:52 AM
tobiu
tobiu Jan 12, 2026, 5:52 AM

Input from Gemini 3 Pro:

✦ I have implemented a Batching Strategy for insertNode operations in src/main/DeltaUpdates.mjs.

The Solution: Contiguous insertNode operations targeting the same parent are now grouped into a single DocumentFragment. This batch is built in a detached state and inserted into the live DOM in a single atomic operation.

Performance Impact:

  • Reduced Reflows: Instead of 300+ individual insertions triggering layout calculations, we now have 1 reflow per batch.
  • Stability: We experimented with "Time Slicing" (generators) but found that the overhead and complexity outweighed the benefits for the initial viewport render (which takes ~60ms synchronously). The "blank page" risk of async rendering was deemed too high.
  • Result: The "slow operation" warning for large lists (e.g., 300 items) is now contained to ~40ms, which is within acceptable limits for a synchronous main thread operation.

Status:

  • Time-slicing logic has been reverted.
  • Performance logging has been removed.
  • Batching logic is active and verified.

Ready for final review.

tobiu assigned to @tobiu on Jan 12, 2026, 5:53 AM
tobiu closed this issue on Jan 12, 2026, 5:53 AM