Advertisement
Membership
Login
ACCU Buttons
Search in Book Reviews
Search is a simple string search in either book title or book author. The full text search is a search of the text of the review.
I’ve always been an advocate of avoiding gratuitous premature pessimization (is it ever possible to mention optimization without quoting or paraphrasing Knuth/Hoare?). So this book was pretty much up my street. It’s well written, and I liked the fact that it uses C++11 – there’s no point in pandering to the laggards that are stuck in the last century. There are 13 chapters that cover an introduction, hardware and timing, algorithmic optimization, low level optimizations (code changes, memory use, I/O and threads) and memory management.
I enjoyed the coverage of timing, and in particular the limitations and evolution of the timing features available on x86 based systems. Another high point was the debunking of some myths like std::vector
always being significantly faster than std::list
, along with fairly wide ranging tests. However, this leads me to one of the weaknesses. Pretty much all of the testing was done with one compiler (MS Visual Studio) and platform. So without a wider range of platforms and compilers I found myself taking the results with a pinch of salt.
There were three things that struck me as missing. In Chapter 4, there is a lengthy discourse on optimizing a function that strips control characters from a string. One of the techniques used is pass by reference. This results in an 8% performance degradation, which is not explained in any way. I would expect a book like this to get to the bottom of such as issue. The second thing that is missing is detailed coverage of profiling tools. The author seems to prefer instrumenting code with timer calls, which is good enough, but I thought that there should have been some explanation of the different kinds of profilers and some example usage. Lastly, a lot is said about std::string
and its performance not being great. However, there is no mention of the Short String Optimization (SSO). I was expecting some mention of it and perhaps characterizing the performance ‘knee’ is string lengths exceed the SSO threshold.
In summary I enjoyed reading this book and learned a few things but there were a few annoying nits.
Recommended.