3 ms·
> - performance is important in much of the project At scale this always becomes true. C++ can be written with reference counting and other high level concepts
by joejev 10y ago
> - performance is important in much of the project
At scale this always becomes true. C++ can be written with reference counting and other high level concepts with runtime penalties. When you need to optimize or scale, you will never need to look to another language. I do a lot of numerical computing in Python and often need to drop into Cython or C; in C++ this wouldn't need to happen. One the the main goals of C++ is that "there is no language below C++".
High level language constructs are always nice, and C++ has a lot of "zero-cost" abstractions, meaning you only pay for what you need. For example, an iterator in C++ can just be a raw pointer in the case of iterating over a vector, but it is more complicated for a std::map because it is backed by a tree. C++ is a high-level language, so I don't understand the argument that you would be better off splitting your stack between the "important" parts and the slow parts.
- harry8 10y agoOverstated. There is a level below c++, namely assembly intrinsics. When it comes to simd code using sseN avxN you really do use them when performance is important. That's if you're staying on the CPU. Going massively parallel on a GPU? FPGA? C++ isn't as low as you go.
- MaulingMonkey 10y agoI'd have more time to optimize at these lower levels if I wasn't stuck babysitting C++ codebases to protect them from and fix their undefined behavior.
- Pitarou 10y agoBecause combining low-level performance and high-level abstraction in the same language comes at the cost of a heavy cognitive burden.