-
-
Notifications
You must be signed in to change notification settings - Fork 202
Optimize DOM hot path DeltaUpdates to reduce GC pressure #9317
Copy link
Copy link
Closed
Labels
Description
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:
- Replaced
Array.from(childNodes).find(...)with standardforloops inDeltaUpdates.mjs(getFragmentNodes,removeNode,updateVtext). - Replaced
Object.entries(delta).forEach(...)withfor...inloops inDeltaUpdates.updateNodeandDomApiRenderer.createDomTreefor attributes and styles. - Removed a duplicate
getFragmentNodesmethod fromDeltaUpdates.mjs.
These changes should yield a measurable reduction in memory allocations and frame drops during intense update phases.
Reactions are currently unavailable