When comparing C++ with other popular languages (Python, Java, C#, etc.), it comes clear that adequately written programs on C++ almost surely will be faster than the analogous programs on the other languages.
But ever C++ is divisible by speed.
- In standard projects it’s common to use classes like
std::shared_ptr
instead of raw pointers, to have a lot of memory allocations, to forget usingstd::move
, etc. - It a-bit-non-standard projects (browsers, compilers) things are getting tougher - there is small vector (a vector on the stack), static polymorphism (using CRTP instead of virtual methods),
std::string_view
pointing to somewhere instead ofstd::string
. This isn’t unusual for most programmers. - But real-time programming is another world. It’s forbidden to make syscalls, to block threads, to use algorithms slower than $O(1)$, and so on. This is needed for processing signals and sound, HFT systems…
There is a nice talk about the third disivion by Timur Doumler:
This talk was very interesting for me, as I had not so much experience in real-time systems.