top | item 26038790

(no title)

chundicus | 5 years ago

Likely a joy for Rust and a desire to try something ambitious that hasn't really been done.

Rust doesn't have the mature libraries that C# offers, but it isn't barren anymore either. It does offer nice assurances like entirely avoiding race conditions by default (when using safe Rust). Rust often leads to performant code, but it's hard to say if that's really a feature of the language or just a bias due to the kinds of people using it and the projects they work on.

If you're just looking to get into game development without any other goals in mind, then C# is a safer choice

discuss

order

carlmr|5 years ago

>Rust often leads to performant code, but it's hard to say if that's really a feature of the language or just a bias due to the kinds of people using it and the projects they work on.

It does make memory management much more explicit, which makes it at least easier to write performant code.

The question however is what your program is doing. If it's limited by network requests or something similar with high latency you won't be able to optimize much on the language side of performance.

If however you're processing a lot of strings, the safe borrowing mechanism can help you avoid most copying.

For example on my previous job we had a part of our CI build that would parse a huge text file and combine it with some information from an ELF's debug info in Perl. It took 45 mins for one execution. It was also impossible to read.

I rewrote it in F# which after some heavy optimization work worked through it in 2 mins.

I had just heard of Rust and rewrote it in Rust, basically transforming F# to Rust syntax and trying to eliminate as many copies as possible. Now the whole execution took 8s.

So at that point I was sold on Rust, however the library ecosystem was still lacking. Nowadays it's much better.

therein|5 years ago

> I had just heard of Rust and rewrote it in Rust, basically transforming F# to Rust syntax and trying to eliminate as many copies as possible. Now the whole execution took 8s.

For what it is worth, I've had a very similar experience with the re-write of an internal tool in Rust.

I was in pure disbelief, running the next command in the toolchain this tool runs in, expecting it to fail on some empty input files but it worked. 20x speed-ups almost feel like some essential work must have been missed or skipped but when you realize that's not the case, it is a different kind of pleasure.

Xevi|5 years ago

> It does offer nice assurances like entirely avoiding race conditions by default (when using safe Rust).

Doesn't it "just" prevent data races? I don't think it prevents all race conditions.

chundicus|5 years ago

Data races is what I meant; good catch.