What kind of perfomance benefits Svelte gets for having no virtual DOM?
Asked Answered
A

2

6

I have a question about svelte, if svelte is not adapting Virtual DOM or Shadow DOM mechanism, how is it generating high performance applications, because svelte is just a compiler, which generates the pure javascript build, is this is the only takeaway of svelte, converting to pure javascript code, will yeild you high performance applications?, then why react or angular using the Mechanism like Virtual DOM or Shadow DOM

I know this is not a coding question, but I wanted the answer, so only posted here, please do not delete or devote this post. I want to understand the internals

Thanks

Ardolino answered 23/3, 2023 at 12:53 Comment(1)
softwareengineering.stackexchange.com might be a better place for this sort of questionBakery
O
4

For most use cases, Svelte is faster than React / Angular.

This is because Svelte does not use virtual DOM. The core value promise of Svelte framework is to eliminate virtual DOM overhead.

The virtual DOM overhead comes from the fact that a framework needs to construct nodes in a separate format and then perform a diff.

Older answered 24/3, 2023 at 11:6 Comment(0)
T
2
  • In react.js, browser will load react library, reactDOM and then it will load the project code. this makes react project larger in size. From here

The Svelte implementation of TodoMVC weighs 3.6kb zipped. For comparison, React plus ReactDOM without any app code weighs about 45kb zipped. It takes about 10x as long for the browser just to evaluate React as it does for Svelte to be up and running with an interactive TodoMVC.

All code is buggy. It stands to reason, therefore, that the more code you have to write the buggier your apps will be.

Writing more code also takes more time, leaving less time for other things like optimisation, nice-to-have features, or being outdoors instead of hunched over a laptop.

  • Svelte is a compiler. It does not run in the browser. The compiled code will directly modify the DOM without the overhead of the virtual DOM. You can read Virtual DOM is pure overhead
Triciatrick answered 21/11, 2023 at 2:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.