Selective Inlining

One of the most egregious deficiencies in C++ is the syntax and flexibility of its inlining mechanism. Although generally useful, it is painfully unsophisticated. There is no mechanism for selective inlining; that is, inlining a method in some places and not inlining it in other places. This makes inlining decisions an all or nothing choice, ignoring the reality of fast path optimization. For example, suppose a program's fast path (the typical execution sequence) contains two static invocations of a method that has an additional 20 static invocations outside the fast path. There is no simple mechanism for inlining the method in its two critical call locations and relying on the normal call mechanism for the remaining ones. ...

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.