React has a lot more overhead than svelte. This is from my limited understanding.
So take that with a grain of salt. But the virtual dom causes overhead. You have to do virtual dom diffing and then also make the changes to the real dom and sometimes one change to a div will require the whole component to rerender. So svelte being a compiler can build very clean code that doesn’t need to use virtual dom.
Overhead of virtual DOM is greatly, and I mean greatly, overstated. Preact is nearly as fast as Svelte, and Inferno is faster - both are vdom libraries.
React's overhead comes from other places, like literally re-implementing event system.
Svelte is still component/control flow granular so it does do a nice chunk of re-evaluation, but it doesn't need in most cases to traverse down all its children. This makes it much faster than naive VDOM implementations. Precompiling DOM operations without running through what amounts to a giant switch statement for each part of the template also gives some nice gains.
Yeah you can see how fast svelte is but this article doesn’t show react vs able te the actual site has all frameworks. I couldn’t find the actual site but that allows you to pick and choose frameworks for comparison. This article still shows vanilla js vs svelte which is a good comparison.
Not quite sure I follow. But all the major players are there including React/Svelte/Vue and full tables of 20 libs tested are included at the end of the article if you want to see all side by side. Although IMO the commentary is as valuable as the graphs. Mostly we get to see the raw technical performance with all the marketing hype shelved for a minute. The highest performing library is reactive no-VDOM, but 3 out of 5 of the fastest are VDOM.
This is what I was trying to find. The article linked above just had screen shots but didn’t show all js frameworks.maybe I missed all of them together.
The virtual dom can be fast and has its place but still has overhead. Doesn’t mean it can’t be fast but you can get faster with something like svelte that is compiled and built to be performant.
Yeah it does show all the frameworks. And it does show Svelte being outperformed in every performance category and in size by a couple VDOM libraries. There are benefits to Svelte's approach but the meaningful impact of this overhead is variable. There are many types of overheads. Svelte has its own overhead/inefficiencies in other areas otherwise it would be front of the list. So while its fun to play at conceptual ideal, Svelte has similar although different conceptual walls based purely on its architecture.
Forsure this is definitely true. Every tool has various pros and cons. And some libraries that don’t use a virtual dom like angular are slow. So it definitely deends on the framework and isn’t all virtual dom VS dom.
I do know why, you can also read the article I posted. In most case the virtual dom is fast enough but there is still overhead to render everything at runtime
We were talking about the dom vs virtual dom though which has nothing to do with routing. Seems like you don’t know what the DOM is or how the virtual dom works and are just saying stuff now.
Kind of embarrassing that you tried to call me out saying “do you even know why there is a virtual dom or do you assume more = bad” to then go on and say the virtual dom “it makes it so you don’t have to have multiple server request compared to a static html setup ”to show you don’t have the slightest clue what the dom is or how it works or even how the front end works for that matter. Then when I ask what you mean you say “client side vs server side routing”
You don’t have to request a route from the server each time you want to update the state or the ui even if you aren’t using vanilla js(I.e no virtual DOM). You can can make a change directly to the page with the DOM without having to request a new page from the server as you are suggesting, which again makes no sense to the context of the discussion above.
The virtual DOMs main purpose is not client side routing. It’s main purpose is to help abstract away dom manipulation. But the virtual dom still has to eventually use the real dom to make changes (I.e remove an item from a list since a user clicked a button).
I just think it’s funny for someone to go around accusing another person of not knowing what something is when they make it very clear they don’t have the slightest clue what the dom or virtual dom are. Maybe next time look something up if you are unsure or don’t know something before you make an aviation like that. You know...learn a little. It’s sure is better to learn something than to show your arrogance.
This is completely incorrect though. The virtual dom is not faster than the real dom. It’s an added layer used to interact with the dom.
Why you you update an entire page to change when piece while using the regular dom. There is no rule you have to do this. I can easily change one node of the dom (an html element) without change every other node.
Again the virtual dom has to use the real dom. It’s like you didn’t read anything I said or just have no clue what your talking about. It is embarrassing for you. Because everyone here that knows what the dom and virtual dom is and how they work can see you trying to make shit up to not seem like a fool for making your original comment but then you keep going further.
Anyways just next time don’t make a comment like that when you don’t really know how something works.
I should but I do make that mistake all the time. Thanks for pointing that out.
I think for me it is the way I say it in my head. I hear the words being said in my head and I forget to make the difference between the two.
I hope to get better at it and really do appreciate you calling me out, hopefully will save me from looking like an idiot in front of someone important.
Well it’s true. I made a mistake and I have trouble with mixing up then be than even knowing than is for comparisons. Something in my head. Anyways I need to be better at it and no spelling in general(I have sausage fingers when I type on my phone).
7
u/[deleted] Jan 16 '21 edited Jan 16 '21
React has a lot more overhead than svelte. This is from my limited understanding.
So take that with a grain of salt. But the virtual dom causes overhead. You have to do virtual dom diffing and then also make the changes to the real dom and sometimes one change to a div will require the whole component to rerender. So svelte being a compiler can build very clean code that doesn’t need to use virtual dom.
Here is a good read: https://svelte.dev/blog/virtual-dom-is-pure-overhead
Edit: grammar