I've heard many words about the move semantics introduced in C++11. In theory, it should bring much performance improvement due to the fact it avoids unnecessary copies.
However, there have already been some optimizations for legacy code during compilation to deal with the inefficient temporary copies, such as:
- (named) return value optimizations
- constructor copy elision
And additionally for frequently used data structures, some C++ standard libraries use special optimizations (e.g., small string optimization for std::string
).
More importantly, although some pieces of legacy code are really inefficient they don't result in much latency since they are
- not frequently invoked
- modern computers have enough physical memories for them
So I'm asking: are there real-world examples that greatly accelerate the performance when using modern C++ (C++11/14/17) syntax, or improve the performance by a reasonable percentage (e.g., >10%) overall?
If possible, please show some performance bugs/bottlenecks existing in real world repositories that can be dealt with modern C++ very well.
Aucun commentaire:
Enregistrer un commentaire