Chapter 4. The Return Value Optimization

Anytime you can skip the creation and destruction of an object, you are looking at a performance gain. In this chapter we will discuss an optimization often performed by compilers to speed up your source code by transforming it and eliminating object creation. This optimization is referred to as the Return Value Optimization (RVO). Prior to delving into the RVO we need to understand how return-by-value works. We will walk through it with a simple example.

Get Efficient C++ Performance Programming Techniques now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.