The main reason we have been using things like VDOM is to compare if the data has changed or not and if so when to re-render the new changes. There are many diffing algorithms that are fast and we would update something if it has changed, but updating things directly will always be faster. In libraries like React the virtual DOM tries to compare its state with the current DOM state and if there is any difference it will ask the reconciler to apply those changes to the DOM. The part where it gets slow is the reconciliation phase. This is because diffing isn't free. It is nothing but just pure overhead. For more info, this is what the react docs have to say about virtual dom and this is what Svelte has to say about it.
Thank you for the answer, the article on the Svelte website makes total sense. I guess I need to learn more about how Svelte is updating the DOM without any diffing algo.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Long story short: Diffing isn't free
Explanation
The main reason we have been using things like VDOM is to compare if the data has changed or not and if so when to re-render the new changes. There are many diffing algorithms that are fast and we would update something if it has changed, but updating things directly will always be faster. In libraries like
React
the virtual DOM tries to compare its state with the current DOM state and if there is any difference it will ask the reconciler to apply those changes to the DOM. The part where it gets slow is the reconciliation phase. This is because diffing isn't free. It is nothing but just pure overhead. For more info, this is what thereact
docs have to say about virtual dom and this is whatSvelte
has to say about it.Thank you for the answer, the article on the Svelte website makes total sense. I guess I need to learn more about how Svelte is updating the DOM without any diffing algo.