Hacker News new | past | comments | ask | show | jobs | submit login

I’m skeptical of this finding out at least it’s generalizability. I know (and like) Rust a fair bit better than JS, but I would be surprised if I could build a nontrivial web app in Rust faster than Node. And that’s without using TypeScript. YMMV, but I’d be curious to hear from others with experience with both languages.



I've used Rust for two years and still regularly get stumped.

Recently, I wanted to maintain a map of routes to futures so that multiple in-flight requests could await the same future while it fetches from disk.

The Javascript version took about one minute.

Using Rust doesn't give you free performance wins, especially not when working with async code where lifetimes actually get hard. Any time you're carrying around your own event loop / cpu pool while trying to avoid blocking requests, that's also another bombshell in itself. Similar challenges when using something like NIO/Netty, especially towards the beginning.

Add things like sinking a stream of lazy futures into a response and it can be very hard to understand what your actual performance looks like and where things will block, especially with parallel requests. The only way you could say it's a free lunch is if you're a Rust expert who has done it before, which doesn't apply if you're considering Rust vs JS/TS anyways.

Not to say nobody out there should be writing Rust, that would be silly. But someone upstream is seriously asking what advantages JS could have over Rust and difficulty is one of them. And it's not a small one.


My first attempts with anything in Rust are also challenging. Second attempts, though, are straightforward as long as I have an example to work from and haven't forgotten about it. It would take me a lot longer to build your router example in Node than it did you because I haven't worked with Node but once I know how, maybe it would take me a minute, too.

What did you finally come up with for your router impl in Rust?


I'm fluent in both Rust and JS. IMHO first attempts are much faster in JS than in Rust. Rust is much easier to maintain in the long term, and for large scale codebases it excels once the groundwork has been laid.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: