this post was submitted on 21 Jul 2025
295 points (97.7% liked)

Programmer Humor

25282 readers
658 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[โ€“] ZILtoid1991@lemmy.world 1 points 5 days ago (1 children)

The "better" performance is due to the built-in multi-threading support, and that functional programming makes it relatively safer to pull off. Otherwise single-threaded Rust is very hard to optimize.

[โ€“] anton@lemmy.blahaj.zone 1 points 3 days ago

Rust has monomorphisation like C++ and every function has the aliasing guarantees of restrict, a keyword rarely seen in C code bases use and C++ doesn't even support.
This means you can get more optimisations while writing in an intuitive style, where C/C++ requires some changes to the code.

On the other hand rustc has some hiccups with argument passing and rvo. One could argue that that's just the compiler while the aliasing problems are part of the language in the C/C++ case, but while there is only one rust compiler its performance is the languages performance.

For most use cases they are about equally fast.