Live data from Hacker News

Rust is now overall faster than C in benchmarks

benchmarksgame-team.pages.debian.net

11–20 of 445 posts

Re: Rust is now overall faster than C in benchmarks

#11
I think benchmarking C vs C++ vs Rust must only really be useful for researchers. They’re all making a similar tradeoff for performance: forcing you to consider how you use memory. Does anyone work in a field where the performance difference between these specific three platforms matters? I’m genuinely curious. Edit: also, if you could explain briefly why and what makes particular choices out of the three unsuitable, that would be awesome too.

Re: Rust is now overall faster than C in benchmarks

#12
post #11

I think benchmarking C vs C++ vs Rust must only really be useful for researchers. They’re all making a similar tradeoff for performance: forcing you to consider how you use memory. Does anyone work in a field where the performance difference between these specific three platforms matters? I’m genuinely curious. Edit: also, if you could explain briefly why and what makes particular choices out of the three unsuitable,…

Yeah, databases

Re: Rust is now overall faster than C in benchmarks

#13
From the page: "… a pretty solid study on the boredom of performance-oriented software engineers grouped by programming language." I find this both funny and consider it true to some degree. There's nothing like a good old friendly arms race for the benefit of all (languages and its users, in this case) involved!

Re: Rust is now overall faster than C in benchmarks

#15
post #12
post #11

I think benchmarking C vs C++ vs Rust must only really be useful for researchers. They’re all making a similar tradeoff for performance: forcing you to consider how you use memory. Does anyone work in a field where the performance difference between these specific three platforms matters? I’m genuinely curious. Edit: also, if you could explain briefly why and what makes particular choices out of the three unsuitable,…

Yeah, databases

Could you elaborate a little? I’d be interested in this answer

Re: Rust is now overall faster than C in benchmarks

#16
post #10

One of Rust's performance advantages is the compiler's ability to unambiguously determine memory aliasing. Aliasing is why many numeric kernels are written in Fortran, a much older language that also enforces strict aliasing as it simply doesn't allow overlapping references. There are probably others as well, but this is the advantage I'm familiar with. C's ambiguity makes it harder to achieve some optimizations that…

LLVM's support for this is bugged, so rust does not currently take (edit: full) advantage of it.

Re: Rust is now overall faster than C in benchmarks

#17
post #11

I think benchmarking C vs C++ vs Rust must only really be useful for researchers. They’re all making a similar tradeoff for performance: forcing you to consider how you use memory. Does anyone work in a field where the performance difference between these specific three platforms matters? I’m genuinely curious. Edit: also, if you could explain briefly why and what makes particular choices out of the three unsuitable,…

I think what's most interesting about your comment is the assumption that the three are in the same ballpark. You're not wrong, but it just reminds me of how far we've come. That is, the key is not "which of these three can eke out the last tiny ounce of things," but that Rust has successfully landed across that gap you see in the graph. That it's "(C/C++/Rust) vs everything else" is in of itself an interesting result. You can see some skepticism of the premise elsewhere in this thread, even.

Re: Rust is now overall faster than C in benchmarks

#18
post #11

I think benchmarking C vs C++ vs Rust must only really be useful for researchers. They’re all making a similar tradeoff for performance: forcing you to consider how you use memory. Does anyone work in a field where the performance difference between these specific three platforms matters? I’m genuinely curious. Edit: also, if you could explain briefly why and what makes particular choices out of the three unsuitable,…

It's mostly an exercise that's useful for Rust: Internally, to prove that "it works"* and externally, to make a credible name for Rust.

(*) of course part of the output is also looking at the Rust code and evaluating style and `unsafe`-wise what the price for winning was.

Re: Rust is now overall faster than C in benchmarks

#19
post #7

Shouldnt they be about the same? (At least until the LLVM immutability optimizations happen) I suspect surprising factors are in play.

The ceilings should be similar, but there is an argument that there are cases where idiomatic Rust might outperform idiomatic C or vice versa.

For instance, in real-world usage, you might do a bit more redundant copying in C in places you would avoid it with the borrow checker in Rust.

Conversely, enforcing RAII in Rust might cost performance in some scenarios relative to C.

Post reply on HN