Skip to content

Commit

Permalink
more cache friendly performace tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Dobiasd committed Apr 11, 2014
1 parent 04b8454 commit 43cedc7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions from_goto_to_std-transform.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,16 @@ Even if the `std::transform` version looks like much abstraction induced functio
For 100 million values the different implementations ([source code](https://gist.github.com/Dobiasd/839acc2bc7a1f48a5063)) took the following cpu times on my machine:
```
goto - elapsed time: 0.465151s
while - elapsed time: 0.464604s
for - elapsed time: 0.465315s
range based for - elapsed time: 0.463258s
std::transform - elapsed time: 0.464696s
goto - elapsed time: 0.470183s
while - elapsed time: 0.470266s
for - elapsed time: 0.471321s
range based for - elapsed time: 0.471496s
std::transform - elapsed time: 0.470662s
```
## Conclusion
For better maintainability of your C++ software make use of the cool stuff in the [`<algorithm>` header](http://en.cppreference.com/w/cpp/algorithm). Once you get used to it you will enjoy every for loop you do *not* have to read. ;-)
With [effective stl](http://www.amazon.com/dp/0201749629) Scott Meyers has written a very nice book covering this and more in depths.
Herb Sutter's [talk about lambdas](https://www.youtube.com/watch?v=rcgRY7sOA58) can also help to get more into this topic.
Herb Sutter's [talk about lambdas](https://www.youtube.com/watch?v=rcgRY7sOA58) can also help to get more into this topic.

0 comments on commit 43cedc7

Please sign in to comment.