Virtual DOM overhead

📄 BetterWays.dev wiki page | 🕑 Last updated: Jan 21, 2022

Contrary to the popular belief, Virtual DOM has a lot of CPU and memory overhead.

In React (and other similar libs), you're each time re-creating a whole vdom tree from scratch, diff-ing that tree with a previous one and then applying the changes to the real DOM.

For something lighter and more efficent, check out libs like lit-html and hyperHTML (they are using es6 template literals, so they understand which parts are static and which can change).

Alternatively, see Thin client SPA for places where you can use server side rendering.


Ask me anything / Suggestions

If you have any suggestions or questions (related to this or any other topic), feel free to contact me.

ℹī¸ More info


If you find this site useful in any way, please consider donating. I'm trying to keep it as clean and fast as possible - there are no ads, no affiliate links, and no analytics/tracking scripts.