4 ms·
Because even slow Rust code might have better performance or memory usage characteristics than idiomatic code in these languages. Or because it still protects y
by GrayShade 6y ago
Because even slow Rust code might have better performance or memory usage characteristics than idiomatic code in these languages. Or because it still protects you from race conditions. Or because you like cargo more than, say, maven. Or because you want to learn the language.
- hu3 6y agoI was recently surprised that idiomatic Go can be faster than idiomatic Rust: https://news.ycombinator.com/item?id=26463967 https://news.ycombinator.com/item?id=26463967
- GrayShade 6y agoI haven't read that article yet, but I wouldn't really call the simple Rust version idiomatic. Stdin::lines() incurs a string allocation for each line (fixing this takes three lines of source code), which can be quite significant. And garbage-collected languages will have faster allocation, so I'm not too surprised. Of course, I know who the author of that code is. I just wanted to point out that it's not such a trivial comparison to make.