In today’s fast and competitive world, a program’s performance is just as important to customers as the features it provides. This practical guide teaches developers performance-tuning principles that enable optimization in C++. You’ll learn how to make code that already embodies best practices of C++ design run faster and consume fewer resources on any computer―whether it’s a watch, phone, workstation, supercomputer, or globe-spanning network of servers. Author Kurt Guntheroth provides several running examples that demonstrate how to apply these principles incrementally to improve existing code so it meets customer requirements for responsiveness and throughput. The advice in this book will prove itself the first time you hear a colleague exclaim, “Wow, that was fast. Who fixed something?”
My low rating for this is not due to the fact that this is a bad book, but because the material presented was simpler than I hoped. In essence, there was little new here.
With that aside, I do have some gripes. Despite talking about some parts of hardware (albeit not particularly in depth), little to nothing is said about branch-prediction, which is a fairly major omission. The same can be said of small string optimisation; granted this isn't something mandated by the standard, but the "big 3" compilers (MSVC, GCC, Clang) all implement it, so it would be worth mentioning.
Chapter 10, on data structures, is all extremely basic material in my eyes. Further, emplace / emplace_back is never mentioned, which seems borderline criminal given the subject matter. The author also seems to be in two states of mind regarding usage of C++11 in general; some chapters seem to eschew its usage somewhat, while others (like the chapter on concurrency) obviously require it. The chapter on concurrency itself spends too long reviewing basic material and not nearly enough time on actual optimisation.
All in all, a better title for this book might have included the word "introductory". If you haven't programmed a lot in C++, this book will probably serve as a good introduction to optimisation. If, however, you've been working in the language for a number of years, and you know the standard library well, you probably won't find much new here.
I liked the book and still really want to find a great book on performance techniques. However, this book was not quite it. I hesitate as there were several technical flaws or other issues in the writing, which I detail on my blog.
I'll be honest, I'm more of a C guy, but I stepped in a big C++ codebase a year or two back and am responsible for making parts of it less slow. I found the parts of this book that reviewed some C++ "basics" pretty helpful.
Overall the performance advice seems aimed more at the embedded and desktop software domains which formed the bulk of the author's experience than at the large SaaS C++ codebase that I find myself in. The author isn't wrong that if you don't concern yourself with <10% improvements, you don't have to worry too much about measurement methodology - but a 1% reduction in my employer's compute costs would cover my salary every year for the foreseeable future, so I do actually worry a lot about measuring effects of that size (or much smaller), and this book doesn't really help with that.
The book is also showing its age at this point. It talks about C++11, which was new when it was published, but we're on a newer standard, so I'm not sure how much the details apply. Clang is mentioned once as a relatively new compiler. CPU caches and branch prediction are mentioned in passing but their implications aren't discussed in any great detail. GPUs are dismissed as not something many people are programming for. To some extent this is a Moore's Law Era book. I also think that many of the small-scale optimizations discussed have likely made their way into optimizing compilers by this point.
All that said, the main themes that the author hits repeatedly hold up pretty well. Profile first, figure out what is actually slow before you spend time optimizing it. Amdahl's Law limits the size of the impact of any single optimization. Find ways to do less copying and fewer dynamic memory allocations. Use a faster algorithm that takes advantage of underlying properties of the data. And honestly, these are still big performance-killers that I see in my day-to-day work on modern software.
I also like that this book is relatively accessibly-written. There's a certain informality to it. It happily admits to eliding many of the gory details of move semantics and points you to some references if that's what you want. Likewise some other more arcane topics like reading disassembly or cache behavior or memory ordering or SIMD instructions. Guntheroth strikes me as a working programmer, not an academic pedant - and I like that, because I too am a working programmer just trying to squeeze out a little more speed for as little work and tech debt as possible. If you want to write the fastest possible programs that you can, this book won't get you there (try The Art of Writing Efficient Programs: An advanced programmer's guide to efficient hardware utilization and compiler optimizations using C++ examples maybe). But if you want some practical and simple suggestions for a relatively low time investment, this isn't a bad read at all.