4 ms·
It's more subtle than that. Different languages promote different idioms, in particular via their standard library. C++ is particularly unusual in that you don'
by barrkel 10y ago
It's more subtle than that. Different languages promote different idioms, in particular via their standard library. C++ is particularly unusual in that you don't get much out of the box, and in older projects even things like strings and containers are often custom-built.
The combination of language and library provide affordances that make some idioms easier to represent, and others harder. This influences the design of code written in the language. Clumsy idioms generally don't get far, even if they would be more performant or provide some other benefits, like promote easier concurrency. And sometimes there's a tension: e.g. mutable structures tend to be more performant but harder to add parallelism to, and harder to reason about (leading to more copying than strictly necessary). Rust in particular has different ideas here.
I think the jury is still out on whether Rust will in practice tend to promote code that is faster or slower than C++. Of course any given project in Rust could be rewritten in C++ to be just as fast, or perhaps faster. But that's not what happens in the real world. Human factors matter, path dependence matters, affordances matter.