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 ...

Performance of the STL idiom for list comprehension: Introduction

In my last post, I promised to consider the machine code generated from the STL idiom equivalent to a basic Python list comprehension. As I proceeded, the project expanded to a broader analysis of the idiom’s performance. I am shocked at how much effort this project took. I have spent much of the last five weeks generating and reading the output from g++ 6.2. So. Many. Alternatives. In this post, I’ll describe my baseline for comparison and the criteria I’ll use. In future posts, I’ll present the results.

more ...

A single STL statement equivalent to the basic Python list comprehension

In the last post, I described the structure of the basic Python list comprehension

[expression1(var) for var in expression2 if condition(var)]

and lamented that all the straightforward translations to the STL algorithms required two statements, one for the filter and one for the computation.

more ...