Session Name: | Faster C++: Move Construction and Perfect Forwarding |
Speaker(s): | Pete Isensee |
Company Name(s): | Microsoft |
Track / Format: | Programming |
Overview: |
For performance engineers, the most exciting new features of the C++11 Standard are move construction and perfect forwarding. Anybody who has analyzed C++ performance issues knows that the most inefficient aspect of C++ is object copying. Games often get bogged down copying objects inside frame loops. Rvalue references, a new C++ language feature, enable move semantics and perfect forwarding, completely eliminating unnecessary copies. The problem associated with the creation and destruction of temporary C++ objects goes away. The result: major performance improvements in common code. Simply recompiling with C++11 gives an automatic performance boost, but the true power comes when you add move constructors and move assignment operators to your own classes. This talk shows how to branch at compile time based on the condition that an object is moveable or not, with background on how rvalues really work, along with recommended idioms and best practices. |