Frontmatter
| id | 9317 |
| title | Optimize DOM hot path DeltaUpdates to reduce GC pressure |
| state | Closed |
| labels | enhancementai |
| assignees | tobiu |
| createdAt | Feb 26, 2026, 11:00 PM |
| updatedAt | Feb 26, 2026, 11:02 PM |
| githubUrl | https://github.com/neomjs/neo/issues/9317 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Feb 26, 2026, 11:02 PM |
Optimize DOM hot path DeltaUpdates to reduce GC pressure
tobiu assigned to @tobiu on Feb 26, 2026, 11:01 PM

tobiu
Feb 26, 2026, 11:01 PM
Input from Gemini 3.1 Pro:
✦ The optimizations have been successfully implemented and pushed to the
devbranch.
- Replaced all instances of
Array.from().find()withforloops inDeltaUpdates.mjsto eliminate array allocations.- Replaced
Object.entries().forEach()withfor...inloops inupdateNodeandDomApiRenderer.createDomTreeto avoid temporary arrays and closures.- Removed the duplicate
getFragmentNodesmethod inDeltaUpdates.mjs.These changes should significantly reduce GC pressure in the main thread during heavy DOM update operations. Closing this ticket.
tobiu closed this issue on Feb 26, 2026, 11:02 PM
This ticket covers a set of optimizations in the hot path of DOM updates (
src/main/DeltaUpdates.mjsandsrc/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 andObject.entries().forEach()for object iteration, which creates significant garbage collection (GC) pressure due to intermediate array allocations and closure creation.Changes:
Array.from(childNodes).find(...)with standardforloops inDeltaUpdates.mjs(getFragmentNodes,removeNode,updateVtext).Object.entries(delta).forEach(...)withfor...inloops inDeltaUpdates.updateNodeandDomApiRenderer.createDomTreefor attributes and styles.getFragmentNodesmethod fromDeltaUpdates.mjs.These changes should yield a measurable reduction in memory allocations and frame drops during intense update phases.