Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I really do not understand the appeal of Svelte, it seems to be making all the same horrendous mistakes as Vue (bad templating/DSL that shoehorns control flow and bindings into DOM representation, esoteric lifecycle hooks etc) and the only advantage it clearly has over other frameworks that I can see is simple components can generally be written more concisely.

Are there actually any tangible benefits to using it over other frameworks, or is this all just a heap of people getting excited because it's "new and shiny" (compared to React, Angular etc)?



- Instead of virtual dom + diffing, svelte applies direct DOM manipulation exactly where needed

- Smaller code size. No loading of general runtime library, and I've heard people argue that each component(or page) has its own runtime (I may be wrong in the details)

- Many common tools are built-in, like stores and animations, and since there's no general runtime, if you don't use a particular tool, it doesn't get included

- For beginners, the tutorial is a blessing, they can pick up the framework while learning Js on-the-fly (I'm doing this with my nephew)


Smaller code size only applies for small projects. Preact is like 4kb (I believe you could print off the minified source on one side of a sheet of paper) and most full vdom implementations are still only 40k or less over the wire.

Once you have the runtime, it’s a fixed size. In Svelte though, every new component must carry not just the description of changes, but also reinvent the wheel by reimplementing each time. How many components do you need to reach 4K or even 40k? Even a small app can easily reach the size inflection point.

Also note that inlining code works differently in a JIT. Your code must run hundreds of times to be optimized. In a vdom, that is done almost instantly for all the most critical render code paths. In contrast, infrequently used svelte components are never going to optimize. This has the effect of making svelte look very fast in micro benchmarks which run the same few components repeatedly, but doesn’t reflect your performance when the user opens up something different and winds up back in interpreted mode.

Preact is a nice middle if you’re concerned about garbage. In addition to being tiny, it diffs against the DOM directly instead of using a vdom.


Tangible benefits? It's simple.


I would argue requiring your whole team to learn a new framework-specific templating language and patterns is not simple, compared to using something that is plain JS/TS which the whole team already knows. It also complicates hiring, as programmers who know JS/TS and can pick up React/Angular/etc are a dime a dozen, in contrast to trying to hire programmers to work with a niche framework which has a lot of domain specific knowledge.


It sounds like you are claiming that it's easier for a javascript Dev to learn react than svelte.

Sure, there's more devs who currently know react.

But "easier to learn react" is crazy. The svelte tutorial is short and awesome.


Simpler to write, batteries included and with better performance (in both bundle size and runtime performance) than React.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: