There have been many, many DOMs – Incremental DOM, Shadow DOM, Virtual DOM – But I'm not sure what the Memoized DOM is. I know what memoization is, and as far as my searches tell me that "DOM memoizing is caching the work of functions that modify the DOM". So isn't that supposed to be similar to VDOM?
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (3)
Ohh interesting, I did not know about Memoized DOM. I have been reading and somewhat understand how it works. Let me try to break it down a bit for you.
What they claim is, that instead of returning a tree each time render is called, and then performing the diffing against the VDOM. What they do is, depending if it's the first time rendering or subsequent calls to render, they execute one logic or another. For example the first render some mor work is needed to setup the dom and such, after that only some things need to be updated. They update the dom directly. Let see one of their examples:
For example take this Imba code:
This would compile down to something resembling this pseudocode:
If you follow the pseudocode, you can clearly see this in action. If the component is not rendered, it will build the DOM elements. After that only the textContent is updated. And if you notice, the dom is directly manipulated.
I don't know exactly where the Memoized label comes from though 🤷♂️ I have not research as much, so I might have missed something.
I found this here, worth a read!
Thanks a lot man, makes perfect sense!
I heard a few weeks ago that a framework which I can remember which one use tagged template literals for html and that the tag htm'' does something to the string which is similar what vdom does but it does it on the fly somehow and without needing a vdom maybe this is something similar.