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

- 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.




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

Search: