6 ms·
Path to Rust – A practical introduction
- klapinat0r 10y agoPrevious (fruitful) discussion here: https://news.ycombinator.com/item?id=11774850 https://news.ycombinator.com/item?id=11774850
- deleted 10y ago[deleted]
- foota 10y agoI decided to try out rust in a game jam hosted at my university a few weeks ago. It was a great learning experience, which is to say that it was incredibly frustrating in a good way.
- sargas 10y agoThat's a good way to get into the language, as long as you have someone to guide you through the borrow checker during the jam.
- foota 10y agoI didn't haha. I spent probably a good 3 hours trying to figure out why I couldn't mutuably store a value I got out of a hashmap. It was fun though :) a throwback to when I was learning c and didn't get pointers.
- sargas 10y agoThe learning pain is comparable to C pointers when you first see them haha. Funny thing is that after getting used to the borrow checker and other nice things of the language, its sad to go back to the languages I use at work.
- smitherfield 10y agoRust is an interesting language, although I haven't really had the time to really sit down and play with it (just switched jobs to become a mobile developer while knowing no Swift/Obj-C and not much Java, so I've got my hands full for at least a few weeks). I've been watching Rust on that Benchmarks Game site for a while — it's been interesting to see it go from worse than Java a year or so ago to competitive with C++. It was slightly beating C++ for a couple days, although just recently C++ took its biggest lead in a while[0]; I think they upgraded the GCC version they were using. Anyway, I'm very curious whether it ultimately turns out that, as advertised, Rust's performance characteristics really are as good or better than C++'s[1]. [0] http://benchmarksgame.alioth.debian.org/u64q/which-programs-are-fastest-firstlast.svgz http://benchmarksgame.alioth.debian.org/u64q/which-programs-... [1] The "Benchmarks Game" site very fairly specifies the algorithm that must be used for each benchmark — many of them say data must be operated on sequentially, so IMO Rust is getting a bit of an unfair advantage if the compiler is able to be particularly aggressive at autovectorizing it. OTOH that is a nice real-world speedup, and anything else that's implemented with LLVM or GCC also has access to that optimization, so YMMV.
- sargas 10y ago> Anyway, I'm very curious whether it ultimately turns out that, as advertised, Rust's performance characteristics really are as good or better than C++'s[1]. From my limited experience, Rust's performance is comparable to C++ throughout, with the added safety guarantees that Rust is known for.
- valarauca1 10y agoCurrently if Rust under performs C/C++ by a significant margin it's treated as a bug. (The number crunching on benchmark game is done with SIMD which Rust is working on)
- adwhit 10y ago> I've been watching Rust on that Benchmarks Game site for a while — it's been interesting to see it go from worse than Java a year or so ago to competitive with C++ To be clear, Rust-the-language has not sped up significantly in the past year. It's just that a few dedicated people decided to try to win the benchmarks game strictly for PR purposes [0]. Chances are, for very algo-heavy (i.e. unrealistic) workloads, there are two ways to write it in Rust - fast and safe or very fast and unsafe. (e.g. one can disable bounds checking and get maybe a 2% speedup). All this really serves to show is how artificial the benchmarks are. [0] https://llogiq.github.io/2015/10/03/fast.html https://llogiq.github.io/2015/10/03/fast.html
- sargas 10y agoThe article itself points to a HN discussion: https://news.ycombinator.com/item?id=11774850 https://news.ycombinator.com/item?id=11774850 I didn't see it until it was mentioned here. I can't seem to delete this discussion. So I added the original link here. Please head there.
- Jonhoo 10y agoIt was, in fact, originally posted at https://news.ycombinator.com/item?id=11773332 https://news.ycombinator.com/item?id=11773332 by me (the author), but that post never got much attention :p
- sargas 10y agoYour article is great. The examples of functional and non-functional uses of Rust were neat. I've been practicing by doing the Rust track on exercism.io and, by comparing my solutions to others', I always get impressed by how equally performant those two versions are (at small programs at least).
- Jonhoo 10y agoThanks! Glad to hear that you found it interesting :)