Live data from Hacker News

Svelte’s characteristics that likely contribute most to improved performance

chuniversiteit.nl

161–170 of 205 posts

Re: Svelte’s characteristics that likely contribute most to improved performance

#161

Earlier quoted context omitted.

The reason the web changes so fast, and there are so many rewrites, is the same reason a puzzle whose pieces don't fit together keeps getting shifted around and restarted. People are looking for a satisfying non-leaky abstraction to build upon and they don't find it with web technologies. They get close, but those last few pieces never quite fit, and we lack the power to reshape the pieces, so we tear out all the pie…

This is insightful. I remember thinking after the first generation of SPA frameworks like Backbone and Ember and—somewhat later—AngularJS that maybe the second generation (React, Vue, etc.) would get it all sorted out and we'd arrive at stability and consensus. But that hasn't happened. The next generation was better in some ways, worse in a few, and still not quite right in many others. Of course I hear plenty of pe…

Web is simultaneously not really designed for apps but also a sort of golden environment for app development because it is the one thing that ships on nearly every consumer machine that behaves more or less the same with an actual standard.

People bemoan the lack of native development, but the consuming public (and the devs trying to serve them) really just want to be able to do things consistently across phones and laptops and other computing devices and the web is the most consistent thing available, and it is the most battle-tested thing available.

Re: Svelte’s characteristics that likely contribute most to improved performance

#162

I still like Svelte, but to me SvelteKit has taken up too much of its mind/devshare. Svelte itself is fantastic, especially as a Vue guy I love the "new" reactivity system/runes, but SvelteKit for me is horrible. It's just a hodgepodge of over engineered crap to cater to React/Next devs, and the Svelte team has also been hell bent on horrible decisions like the abomination that is routing[1] in SvelteKit. To me Kit i…

The router is really baffling, agreed. Magic file names make me so frustrated, and even more so when they all start with the same prefix so all my editor tabs look the same. I wish they’d just make a simple single file router that works the same as every other one. There are a lot of things that aren’t perfect in Vue, which I primarily work on, but the router isn’t one of the things that bothers me. It mostly just works.

Re: Svelte’s characteristics that likely contribute most to improved performance

#163
post #130
post #111

Earlier quoted context omitted.

Silverlight was awesome, too bad Microsoft abandoned it. You think they could've done something with it like decoupling from the browser, instead of making all these different UI frameworks that are fizzling out.

The whole reason was working in the browser. WPF was great for desktop, albeit Windows only. So that was wrecked after .net framework became .net core (and thus needed crossplatform). Then some shitheads at Microsoft got the “release new UI framework to get a promotion” annual bug: winui, maui, etc. All that instead of making WPF crossplatform. That’s why C# succumbed to server API only (and games of course, but thos…

> All that instead of making WPF crossplatform.

Avalonia (https://avaloniaui.net/) and Uno (https://platform.uno/) are cross platform UI frameworks for .NET.

Both work in the browser with WebAssembly. Avalonia renders to canvas. Uno can render to canvas or the DOM. Here are a couple of Avalonia demos:

https://solitaire.xaml.live/

https://bandysc.github.io/AvaloniaVisualBasic6/

Re: Svelte’s characteristics that likely contribute most to improved performance

#164
post #51

Earlier quoted context omitted.

This is quite a large set of things to hand wave away with no additional justification. Makes it sound more like personal bias than meaningful insight

You are right, my reasoning is as follows (though still 100% personal bias). For writing a web server library, like oak or flask or etc etc: First, resources own the methods, methods don't own the resources, so the path comes first, easy enough, its just a string with potentially placeholders whose values need to be shunted down the line Next is the method, for some reason a lot of libraries like to hardcode these? I…

Not sure I follow the first part of what you're saying.

For the part where you're describing what's possible or not in TypeScript/JS, though, you're incorrect:

You can't do something like title("hi") vs title({attr:123}, "hi")

Yes, you can. In JS it's trivial; in TypeScript, you can even do it while preserving type safety. Here's the function in TypeScript:

    // First define which signatures are allowed
    function title(content: string): string;
    function title(attrs: Record, content: string): string;

    // Then, implement the function, handling the two possible cases:
    function(contentOrAttrs: string | Record, maybeContent?: string) {
      const content = typeof contentOrAttrs === "string" ? contentOrAttrs : maybeContent!;
      const attrs = typeof contentOrAttrs === "string" ? {} : contentOrAttrs;

      // now use content and attrs as you please
    }
This will be typechecked by the compiler so that if you call title("hi"), it'll know there are no more arguments, and if you call title({ attr: 123 }, "hi"), it'll validate that the first argument is a Record and the second argument is a string.

Re: Svelte’s characteristics that likely contribute most to improved performance

#165

Is this AI? How is Blazor a JS framework, let alone a popular one? Also no Solid.js?

The article is a bit old but I don't think that it was AI, like, no offense but like before AI mania no one would have ever thought that calling blazor js framework would've discredited everything the author wrote by three words Is this AI? Fun fact just asked chatgpt, and even chatgpt says that blazor is not js framework, so the fact that author did say makes it prove that it was just a mistake and not some AI thing…

I was being a bit tongue in cheek, I doubt an AI wrote the whole article but it feels a bit off in a way that AI can do.

Re: Svelte’s characteristics that likely contribute most to improved performance

#166
post #150

Serious question: is rendering throughput as much of an issue today as it used to be? I feel like CPUs have gotten a ton faster while bundle sizes have gotten larger and mobile networks still have a ton of latency, so network matters more in the scheme of things. Would love to hear other perspectives, though!

Hmmm, it's kind of complicated. A lot of the innovation in JS frameworks has been at the meta framework level, because the client-side framework itself can't really control how data is loaded or how the app is bundled. A lot of work has been done to begin data fetching as quickly and in parallel as possible, like you said because network latency is a big factor for performance. And there is a focus on bringing down bundle sizes. I think Svelte 5 is only a few kb, same with Solid.js. The meta frameworks bring some added weight because they contain the routing and data loading logic.

But especially on mobile, rendering throughput as you put it is still relevant. Especially in response to interactions which cause significant changes to the UI. The "issue" with React is that it's all done at runtime, which does bring significant benefits but loses out on opportunities to optimise things which is what stuff like Solid, Svelte, and Vue's in-development Vapor mode take advantage of via static analysis. The benefit is performance, but you lose out on the dynamic nature of React. That is a tradeoff you need to choose when picking a framework.

Solid and Svelte are so close to vanilla JS levels of performance that you start thinking about how to optimise as if you were directly manipulating the DOM itself. Which is cool, in comparison with React you end up trying to optimise for React instead of the DOM. You still need virtualisation in a lot of cases regardless if you use React or Svelte.

I think the bigger attraction with Svelte and Solid, as well as Vue et al. is the signals / reactivity aspect. You can still tie yourself up in issues with that but it's a better mental model for a lot of developers compared to the pseudo-pure functional approach React takes. React's model can be a pain when you do need to escape-hatch to the dom itself, like you often do with complex animations, or interactions like drag-and-drop. If you can stick to pure React it can often be pretty clean.

React's compiler is designed to minimise redundant rerenders and object instantiation. It seems to help if you look at benchmarks. Still not nearly as quick as the static analysis approach because it doesn't change the underlying semantics (it's just doing stuff you would otherwise do manually for the most part).

So I would say it's still an issue, but so is latency and bundle sizes and that's also seen a lot of innovation and improvements.

Re: Svelte’s characteristics that likely contribute most to improved performance

#167

It's that fast because it uses a declarative model and this ends up being very efficient for a variety of use-cases (I say this speaking from a NixOS laptop; Nix operations are invariably much faster than alternatives, like Docker, assuming you have the technical chops to get them to work)

React also uses a declarative model, in fact React might be more declarative because it's still declarative at runtime, whereas Svelte et al. do a lot of static analysis to turn declarative UI into imperative targeted dom updates.

Re: Svelte’s characteristics that likely contribute most to improved performance

#169

The fact this is already outdated by more recent Svelte releases which changed things drastically is exactly my problem with the modern JS space. So fast moving and most of it is still doing JQuery like reactivity. I am probably just not smart enough to get it, but it reminds me of the constant seemingly pointless rewrites I see in companies. Figure out what works and keep it, is that so hard? Why can other languages…

The reason the web changes so fast, and there are so many rewrites, is the same reason a puzzle whose pieces don't fit together keeps getting shifted around and restarted. People are looking for a satisfying non-leaky abstraction to build upon and they don't find it with web technologies. They get close, but those last few pieces never quite fit, and we lack the power to reshape the pieces, so we tear out all the pie…

>People are looking for a satisfying non-leaky abstraction to build upon and they don't find it with web technologies. They get close, but those last few pieces never quite fit, and we lack the power to reshape the pieces, so we tear out all the pieces and try again. Maybe this next time we'll find a better way to fit them together.

Also keep in mind the web standard puzzle is also changing all the time to try make the puzzle to fit better while developers are designing abstractions to catch up.

That how you get XMLHttpRequest -> ajax -> axio -> fetch and history.replaceState situation.

In general SPA has pushed web towards not so archiving friendly place. And PWA != SPA

Re: Svelte’s characteristics that likely contribute most to improved performance

#170
post #97

The fact this is already outdated by more recent Svelte releases which changed things drastically is exactly my problem with the modern JS space. So fast moving and most of it is still doing JQuery like reactivity. I am probably just not smart enough to get it, but it reminds me of the constant seemingly pointless rewrites I see in companies. Figure out what works and keep it, is that so hard? Why can other languages…

Svelte was pretty much stable between 2019-2024, of all the frameworks it probably changed the least. It's only with the recently released Svelte 5 version that things changed a bit. You have a point but you're giving Svelte unfair criticism here.

Especially since they put effort into making it backward compatible. You can mix Svelte 4 components with Svelte 5 components. Which is pretty reasonable.
Post reply on HN