▲ | drysart 12 hours ago | |
Browser are much better, but directly manipulating the DOM is still extremely slow compared to manipulating Javascript objects; and perhaps even more now than a decade ago it's fraught with performance traps that differ from browser to browser and even between successive versions of the same browser. That hasn't changed in the past decade, and it's not going to change in the next decade either because the DOM has to make certain API guarantees that simply can't be optimized away. It'd take a significant change in how the DOM API works to even get close to achieve performance parity with a virtual DOM. (Like being able to tell the DOM to completely defer layout until you tell it that it's okay to continue.) It's simply much more reliably performant to have all your DOM touching be done in a single batch during a virtual DOM diff resolution than it is to touch it and update it piecemeal as your application's components all mutate their own elements on their own schedules. | ||
▲ | osigurdson 3 hours ago | parent [-] | |
I'm not an expert, but maybe have a look at this and see if it changes your opinion: https://svelte.dev/blog/virtual-dom-is-pure-overhead. |