Why Virtual DOM Is No Longer Needed
The Virtual DOM (VDOM) is no longer necessary. The web isn’t stagnant, and neither are browsers. Yet, I still see people praising it as something cutting-edge and relevant without understanding what it actually is or why it was needed in the first place.
It’s Overhead
To understand why VDOM become overhead, let’s go back to a time when it was actually a useful hack.
We all remember that manipulating the DOM tree is an "expensive" operation, requiring re-rendering/recalculating what the user sees. The core idea was to minimize direct DOM operations.
Here’s how it worked: create an in memory copy of the DOM (the virtual DOM), calculate the diff between the current and new state, then apply only the necessary changes to the real DOM. Additionally, these changes are batched and executed in one go.
Sounds cool? Right? But today, it’s serious overhead, especially when the DOM is huge. Don’t forget: we’re creating a full copy of the DOM in memory, two copies (not one), to then compute diffs, which itself takes time.
Browsers Have Evolved
Browsers aren’t stuck in 2010. Directly updating the DOM is simpler and far less costly than it was 10–15 years ago. Your browser has long since optimized this process, and hardware has improved drastically. Yet, we’re still clinging to the VDOM ritual on top of these optimizations.
If you genuinely believe your JavaScript ritual is faster than C/C++ (which powers browsers), you’re deeply mistaken. You’re just forcing the browser to perform a bunch of extra operations instead of letting it update the DOM directly.
Look at Svelte, Solid, or Angular, they don’t use VDOM and they can still update only the necessary parts of the UI.
Soon, Vue will join their club by ditching VDOM (hello Vue Vapor).
A Note on Vue Vapor
This is a version of Vue that offers rendering without VDOM.
They’ve already merged Vapor into vue/core repository, and judging by the commits, active development is underway. In the near future, they’ll drop the VDOM.
The results speak for themselves:
When asked about the Virtual DOM in your next interview, confidently state that it’s outdated and pointless. Directly updating the DOM is now simpler and cheaper, and the era when it was "expensive" is long gone.