Re:Virtual DOM is pure overhead (2018)
by kabes on Saturday May 18, 2019 @09:51PM
(#19950898)
Virtual dom is an implementation decision for performance a developer shouldn't even be very aware of. The main upside to react is that it has a huge ecosystem.
[ Parent
| on HN ]
Re:Virtual DOM is pure overhead (2018)
by Waterluvian on Saturday May 18, 2019 @10:09PM
(#19950960)
You should at least be aware of the gist, lest you obsess over premature optimization.
1. Changes to the DOM cost a ton more than executing JS code.
2. So don't feel too bad when a render() gets called that doesn't change anything because the virtual DOM swallows that.
> 1. Changes to the DOM cost a ton more than executing JS code.
The point of the article, and of the performance problems that people actually have with React is that this might be true for a small number of JS operations, but that
1) Tree diffs are computationally complex operations that add up for real-sized apps 2) The diff is actually unnecessary if you simply take into account the structure of templates, so diffs are pure overhead.
So _do_ feel bad when you have a no-op render() in React at least, because the resulting VDOM diff just chewed up CPU and battery for no reason.