DEV Community

Discussion on: Why Virtual DOM?

Collapse
 
dasdaniel profile image
Daniel P πŸ‡¨πŸ‡¦

I'm seeing that svelte is referenced in the comments a lot and seems dismissed as a straw-man argument since the because of the underlying nature of being a compiler (rather than a framework in the react/vue sense).

While Svelte may be a compiler, the common performance bottleneck with frameworks seems to be the diffing of a vdom, and while many strive to optimize the diffing, solutions that have done away with vdom completely seem to be performing the better. Have a look at solidjs, which is not a compiler, and offers a react-like api without the virtual DOM.

Collapse
 
aidenybai profile image
Aiden Bai

I disagree with your assesment, at least for my comments, I generally openly embrace Svelte design principles (like compiling). Otherwise, I may say it is difficult to compare Svelte to MIllion, because they are two very different things.

I imagine that generalizing that "Compiler-based frameworks always perform better than VDOM solutions" is untrue. While it may perform better in certain cases, these compiler libs need to handle many pitfalls and caveats of not using VDOM (i.e codegen, mental model, etc).

I think Solid by itself isn't a compiler, but it does take many compilation steps to optimize it's code.

Collapse
 
dasdaniel profile image
Daniel P πŸ‡¨πŸ‡¦

I think there's a misunderstanding here.

My argument I guess can be summed up as "VDOM is not necessarily the Holy Grail, and frameworks that have chosen another route seem to be performing better"

So to clarify. I agree that svelte is a compiler, and that make it not directly comparable, but am offering Solid as an example of a framework that doesn't require compilation (It is built using brutally efficient fine-grained reactivity(No Virtual DOM))[dev.to/ryansolid/introducing-the-s...]

Of course that's not to take away from the work you've done on million, but rather to clarify that there are other options and hopefully offer some perspective to Why not Virtual DOM

Thread Thread
 
aidenybai profile image
Aiden Bai

I agree with you that VDOM is not the holy grail. Just to note that I never claimed that VDOM was the holy grail either.

I feel like saying that Solid doesn't require compilation is the same idea as saying React technically doesn't require compilation. You can technically run both in the browser without a build step, but at an extremely degraded user experience.

That perspective would be very interesting to hear! Maybe you could write an article on why not Virtual DOM on devto πŸ‘€