LearnNewsExamplesServices
Frontmatter
id9317
titleOptimize DOM hot path DeltaUpdates to reduce GC pressure
stateClosed
labels
enhancementai
assigneestobiu
createdAtFeb 26, 2026, 11:00 PM
updatedAtFeb 26, 2026, 11:02 PM
githubUrlhttps://github.com/neomjs/neo/issues/9317
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtFeb 26, 2026, 11:02 PM

Optimize DOM hot path DeltaUpdates to reduce GC pressure

Closed v12.0.0 enhancementai
tobiu
tobiu commented on Feb 26, 2026, 11:00 PM

This ticket covers a set of optimizations in the hot path of DOM updates (src/main/DeltaUpdates.mjs and src/main/render/DomApiRenderer.mjs).

The main thread can process batches of 600+ deltas at a time. The previous implementations relied on Array.from().find() for NodeLists and Object.entries().forEach() for object iteration, which creates significant garbage collection (GC) pressure due to intermediate array allocations and closure creation.

Changes:

  1. Replaced Array.from(childNodes).find(...) with standard for loops in DeltaUpdates.mjs (getFragmentNodes, removeNode, updateVtext).
  2. Replaced Object.entries(delta).forEach(...) with for...in loops in DeltaUpdates.updateNode and DomApiRenderer.createDomTree for attributes and styles.
  3. Removed a duplicate getFragmentNodes method from DeltaUpdates.mjs.

These changes should yield a measurable reduction in memory allocations and frame drops during intense update phases.

tobiu added the enhancement label on Feb 26, 2026, 11:00 PM
tobiu added the ai label on Feb 26, 2026, 11:00 PM
tobiu assigned to @tobiu on Feb 26, 2026, 11:01 PM
tobiu
tobiu Feb 26, 2026, 11:01 PM

Input from Gemini 3.1 Pro:

✦ The optimizations have been successfully implemented and pushed to the dev branch.

  • Replaced all instances of Array.from().find() with for loops in DeltaUpdates.mjs to eliminate array allocations.
  • Replaced Object.entries().forEach() with for...in loops in updateNode and DomApiRenderer.createDomTree to avoid temporary arrays and closures.
  • Removed the duplicate getFragmentNodes method in DeltaUpdates.mjs.

These changes should significantly reduce GC pressure in the main thread during heavy DOM update operations. Closing this ticket.

tobiu referenced in commit 29b95b1 - "perf: Optimize DOM hot path DeltaUpdates to reduce GC pressure (#9317)" on Feb 26, 2026, 11:02 PM
tobiu closed this issue on Feb 26, 2026, 11:02 PM