Microbenchmarks are highly sensitive to the heap context!

Over two weeks ago, I posted an article about by-value parameters in the loop and transform idioms. Included in one of the plots was an anomaly that, when I considered it more closely, blew up the analysis. In fact, I’ve spent most of the past two weeks following up on the implications of this seemingly small anomaly. Ultimately, it’s given me reason to question the reliability of microbenchmarks in a wide range of circumstances. And after two weeks of work, using a variety of tools, I remain unclear about the underlying phenomenon. I’m writing a series of posts to clarify what I’ve learned to date and to set my future agenda.

more ...

The elegant machine code for char const *

Unique strings—null-terminated strings uniquely identified by their char const *—are the simplest type considered in this series of posts. Constructing, copying, moving, and assigning these strings are trivial operations on a single pointer. No destructor code is required.

more ...

Passing std::string by-value noticeably slows the idioms

The benchmarks comparing transform to a loop also highlighted the substantial contribution that copying values made to their performance. Copying costs become especially noticeable for complex types, such as standard strings too long to fit in the short string optimization.

more ...

Benchmarking the transform and loop idioms

Update: Mon Aug 20, 2018: Also see this semi-rant about the limitations of microbenchmarkering.

more ...

Analysis of code generated from the transform idiom

The last post presented the baseline C++ code and its generated machine code. Now it’s time to compare the code generated by the std::transform idiom and see how well it fares.

more ...