-
-
Notifications
You must be signed in to change notification settings - Fork 202
Optimize VDom Helper hot paths to reduce GC pressure #9318
Copy link
Copy link
Closed
Labels
Description
This ticket continues the GC pressure reduction effort, focusing on the VDOM worker's hot paths (src/vdom/Helper.mjs and src/vdom/VNode.mjs).
The VDom Worker can generate thousands of delta updates. Array allocations and closures inside looping constructs create significant GC pressure.
Changes:
- Replaced
Object.keys().forEach()andObject.entries().forEach()withfor...inloops inHelper.compareAttributesandHelper.createVnode. - Refactored
.forEachloops on child arrays to use standardforloops inHelper.createVnodeMap,Helper.findMovedNodes, andHelper.getFragmentPhysicalCount. - Optimized
normalizeClassNameinVNode.mjsto avoid.filter(Boolean)and.forEachclosures. - Converted
Object.entries().forEach()tofor...ininHelper.updateBatch.
These optimizations will make the VDOM generation and diffing process much lighter on memory allocations.
Reactions are currently unavailable