4 ms·
While JS won’t match Rust for speed, you are likely experiencing WebKits general large performance advantage over Blink as well. A JS dev who knows generally h
by nwienert 4y ago
While JS won’t match Rust for speed, you are likely experiencing WebKits general large performance advantage over Blink as well.
A JS dev who knows generally how to write performant apps can produce some very close to native feeling experiences in WebKit, it simply feels that fast.
Rust meanwhile is a terrible language for UI work. Just like you wouldn’t use assembly for game programming today, or even why you wouldn’t use JS for sensitive systems programming, you don’t use a static compiled, verbose, picky, slow compiling language for a domain that simply demands you have a totally different set of trade offs.
The nature of UI is this: you’re going to iterate a ton, change a ton, you need to be creative and willing to try and throw away experiments as fast as possible, you need the fastest possible feedback cycle between save and hot reload. Your problem space will never be as clear as systems programming. Because the output is visual that time diff between “hmm does this work” and “ok yes/no” needs to be as quick as possible, and you absolutely need to be able to go from idea to output in as quick a time as possible.
This is hugely a function of verbosity, elegance of the libraries and hot reload - JS absolutely crushes Rust along these axis. Meanwhile memory safety isn’t a big concern. But not just that, dynamic languages give you dev tools where you can inspect, edit and test changes and code at runtime and that’s the single biggest productivity boost you’ll find as a frontend dev. These are lessons learned over 20 years of developing for every UI platform under the sun.
The modern web stack is simply going to get you to production with a far higher quality of UI in way, way less time.
I could go on for a lot longer about this topic but suffice it to say: JS is an absolutely incredible language for fronted. It’s set of trade offs match the domain beautifully. I wish it was faster, but WebKit at this point is so much faster and less energy intensive than Blink that I’m extremely happy with app performance in it.
- tayistay 4y agoI think the jury is still out on whether rust is good or bad for UI. Once rust UI libraries are more mature we'll get a sense of it. There are some advantages of static typing, even for UI (see SwiftUI for example). I'll grant the pickiness of rust can be a challenge. Anyway give us some time to work on stuff. Here's my effort: https://github.com/audulus/rui https://github.com/audulus/rui
- nwienert 4y agoSwiftUI looks nice and definitely is the right direction for a compiled UI language. But in practice is terribly hard to work with compared to most web frameworks. Terribly slow recompile, no HMR, miles worse dev tooling, no way to dynamically inspect and change things on the fly. On the web I have my app fully running on one side, and my code on the other. I make a change, it shows. Even if it’s inside a deeply nested pane, with some stateful stuff going on. And if things go wrong, I open the console and I inspect everything, change things, run some code, and fix it. I actually tried SwiftUI on my last app I was making for months before I gave up. It felt like going back to the stone ages. And that’s Apple putting their full effort behind something with decades of UI stuff already in place! Not to mention my files kept getting too big for the Swift syntax checker all the time, but I’m sure they can fix that.