Email or username:

Password:

Forgot your password?
Top-level
rastilin

@crazyeddie @scherzog @lina

The worst part is that in benchmarks, Rust beats out C++ and is only very slightly slower than C (by 7%), but would probably be more secure and more reliable in practice.

It might also be faster than C in production since it can better optimize itself.

8 comments
crazyeddie

@rastilin @scherzog @lina I can readily beat the crap out of a great amount of C code, performance wise, with C++ so I'm not sure what you're measuring there. Look at how a C vs. C++ developer might make a binary tree for example: C++ version is faster and safer. If you want to do build time processing in C you're also stuck with the preprocessor. Maybe the C++ code was crap, or maybe it's something C++ is really bad at...I dunno, but it sounds suspect.

mid_kid

@crazyeddie @rastilin @scherzog @lina Benchmarks like that are ran against theoretically perfect implementations of various algorithms, not whatever a developer would realistically write unless given infinite time and knowledge. Having readily available and well-optimized algorithm and other utility libraries is very helpful, like you say.

rastilin

@mid_kid @crazyeddie @scherzog @lina

So the question is also, which language can self-optimize better? I think Rust would beat out C and C++ in these situations. Though I can't be sure.

crazyeddie

@rastilin @mid_kid @scherzog @lina Entirely possible. C++ uses its type system to help optimize, I'm sure Rust can.

I don't know Rust, but it at least has the potential to do things I don't see C++ ever being able to achieve, or at least a long time. Thread safety for example: way back I watched Meyers present his "red/green" stuff that tried...but it was ungainly and nothing came of it. We have other tools to help, but yeah...it's a thing.

Ludovic Archivist Lagouardette

@rastilin @crazyeddie @scherzog @lina

I do not know what benchmark you are using as comparison as generally C++ is faster than C due to the optimizations afforded by templates.

Modern C++ and Rust are quite on par with one another, both performance-wise and safety-wise. And if a C++ developer tells me they "hate modern C++" I lose all respect for them whatsoever.

I feel like the resistance pulled by the Linux Kernel maintainers stems from ignorance of what Rust does, just like it was the case for C++ long ago. They are trapped in a bubble where they practice between 1 and 3 languages between C, bash and Python and do not have the capacity to currently work with Rust, and feel shoehorned into reviewing code they do not understand well enough

@rastilin @crazyeddie @scherzog @lina

I do not know what benchmark you are using as comparison as generally C++ is faster than C due to the optimizations afforded by templates.

Modern C++ and Rust are quite on par with one another, both performance-wise and safety-wise. And if a C++ developer tells me they "hate modern C++" I lose all respect for them whatsoever.

rastilin

@Archivist @crazyeddie @scherzog @lina

I dug around for the article so I could reference it and I've linked it here. I'm referring to the second column of the first chart, which tracks runtime.

thenewstack.io/which-programmi

Their tests might be a bit simplistic, but even in more complex tests, Rust might be able to optimize more heavily in situations where C wouldn't be able to.

It's annoying to realize, that, for example, PHP is 27 times slower than C.

@Archivist @crazyeddie @scherzog @lina

I dug around for the article so I could reference it and I've linked it here. I'm referring to the second column of the first chart, which tracks runtime.

thenewstack.io/which-programmi

Their tests might be a bit simplistic, but even in more complex tests, Rust might be able to optimize more heavily in situations where C wouldn't be able to.

Ludovic Archivist Lagouardette

@rastilin oh yeah, I remember that one. The C++ code they used was pretty bad, they were writing C++ as if it were Java and taking a bunch of overhead. Expect that C++ is generally between Rust and C in performance (Rust advantage here being not following calling convention that C++ must abide too to just compile, C++ advantage being not taking 6 million years to compile the 24 million lines of the codebase)

crazyeddie

@Archivist @rastilin @scherzog @lina I feel for the maintainers a bit here. It's already a lot of work. It's the same reason teams are slow to adopt new C++ standards and idioms.

Go Up