Live data from Hacker News

Optimizing Software in C++ [pdf]

agner.org

1–10 of 13 posts

Re: Optimizing Software in C++ [pdf]

#3
Lots of good stuff there. Caches(including i-cache and d-cache), volatile(and how it gets mis-construed), pointer-aliasing, float to int overhead, alloca. I don't think I've seen so much good performance stuff in a single place.

Re: Optimizing Software in C++ [pdf]

#4
This is great overall. One nitpick:

> How compilers optimize

This didn't mention scalar replacement of aggregates [1]! This is easily one of the most important optimizations for programmers in C++ and similar languages to know about.

[1]: https://books.google.com/books?id=Pq7pHwG1_OkC&pg=PA331&lpg=... is a reasonable explanation.

Re: Optimizing Software in C++ [pdf]

#8
Anyone who is interested in maximizing the output of computer hardware should read this. 100% of times I've been able to significantly speed up a piece of C++ code, I did it by using a technique from this document. Cannot recommend highly enough.

Re: Optimizing Software in C++ [pdf]

#9

Chapter 14 is twenty-four carat gold. Would love to see optimize.com as a dedicated site with Rosetta Code-style ports of optimization recipes across languages, platforms ;) Quick link to grab all five manuals: http://www.agner.org/optimize/optimization_manuals.zip

> Chapter 14 is twenty-four carat gold

Maybe, but the bounds-checking optimisation [14.2] just looks dangerous. If you end up with an erroneous 'int' index of -1 then the original code will error out, whereas the new code will interpret it as 2^32 - 1. This is a perfectly valid index in an array of 2^32 values. This optimisation just isn't equivalent if INT_MAX Am I missing something?

Re: Optimizing Software in C++ [pdf]

#10
post #9

Chapter 14 is twenty-four carat gold. Would love to see optimize.com as a dedicated site with Rosetta Code-style ports of optimization recipes across languages, platforms ;) Quick link to grab all five manuals: http://www.agner.org/optimize/optimization_manuals.zip

> Chapter 14 is twenty-four carat gold Maybe, but the bounds-checking optimisation [14.2] just looks dangerous. If you end up with an erroneous 'int' index of -1 then the original code will error out, whereas the new code will interpret it as 2^32 - 1. This is a perfectly valid index in an array of 2^32 values. This optimisation just isn't equivalent if INT_MAX Am I missing something?

[deleted]
Post reply on HN