4 ms·
Can you explain (or link some source) why is Virtual DOM wrong? Actually curious.
by czechdeveloper 8y ago
Can you explain (or link some source) why is Virtual DOM wrong? Actually curious.
- lhorie 8y agoHi. I'm the author of Mithril (one of the virtual dom frameworks mentioned elsewhere in this thread), so I think can answer that. To be honest, there's nothing inherently "wrong" with it. There are various techniques to implement templating engines and they all have pros and cons. Lately, VDOM performance in micro benchmarks has sort of plateaued, and recently non-vdom systems like Svelte (an AOT compilation system) and Surplus (a KVO system) have been making some splash as potential candidates to surpass vdom performance. One could argue that it would be "wrong" or "a waste of time" to try to one-up template performance by attempting to make a new vdom implementation because existing ones are pretty much as optimized as they can be. Since there hasn't been nearly as much effort put into alternative algorithms, it probably would be more fruitful to explore a non-vdom approach instead. Do note though that I'm talking about R&D sort of stuff above. For people building actual apps, vdom performance is generally good enough for a vast majority of real-world use cases (evidenced by React's popularity) and one of its appeals is that it lends itself to being manually optimizable it if you do end up with a ridiculously ginormous DOM.
- localvoid 8y ago> Since there hasn't been nearly as much effort put into alternative algorithms Angular2+ team is actually have done an awesome job at experimenting in this problem space. And they've moved away from generating code that is similar to what Svelte does long time ago.