Canvas Performance: severe problems with dom-walker, MutationObserver and ResizeObserver #6067
Labels
Blocked
Canvas
Affects the visual editor
Nontrivial
Requires invention / discovery to solve
Performance
When dragging the border radius slider of the PromiseCard component, we can see egregious performance:
The entire render would be bad enough at 55ms, but we accidentally run it twice because an activating MutationObserver and ResizeObserver.
These observers do not create accidental re-renders during on-canvas interactions, which is where we tested them, so that's good.
BUT the entire system is not fine grained and were designed in a more naive time:
1: we invalidate the entire scene, not just the element
2: it's not controlled when should this dom-walker run happen then
3: we should either rely on the observers OR on the canvas interaction, but not both
4: the dom-walker should never walk entire subtrees during interactions
Possible ideas for building a better solution:
** TLDR end goal is that during an interaction, we really only call getComputedStyle for a handful of elements, and spend almost zero time on merging large jsxMetadata trees etc. ideally ALL OF the metadata update should take 0.1-0.2ms per frame instead of 7-10ms of today**
The text was updated successfully, but these errors were encountered: