Remix.run Logo
mhh__ 11 hours ago

Browsers are much better now, whether it was ever necessary I suppose is like asking how deep a submarine can go in the sense that the post- react frameworks didn't exist

osigurdson 2 hours ago | parent | next [-]

I don't think it is an unanswerable question for someone with (say) 20 years of deep javascript experience and understands the history.

drysart 10 hours ago | parent | prev [-]

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 2 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.