Enjoy fast, free delivery, exclusive deals, and award-winning movies & TV shows with Prime
Try Prime
and start saving today with fast, free delivery
Amazon Prime includes:
Fast, FREE Delivery is available to Prime members. To join, select "Try Amazon Prime and start saving today with Fast, FREE Delivery" below the Add to Cart button.
Amazon Prime members enjoy:- Cardmembers earn 5% Back at Amazon.com with a Prime Credit Card.
- Unlimited Free Two-Day Delivery
- Instant streaming of thousands of movies and TV episodes with Prime Video
- A Kindle book to borrow for free each month - with no due dates
- Listen to over 2 million songs and hundreds of playlists
- Unlimited photo storage with anywhere access
Important: Your credit card will NOT be charged when you start your free trial or if you cancel during the trial period. If you're happy with Amazon Prime, do nothing. At the end of the free trial, your membership will automatically upgrade to a monthly membership.
Buy new:
$50.99$50.99
FREE delivery:
Friday, Dec 15
Ships from
Amazon.com
Sold by
Amazon.com
Returns
Returnable until Jan 31, 2024
Payment
Secure transaction
Buy used: $41.52
Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet, or computer - no Kindle device required.
Read instantly on your browser with Kindle for Web.
Using your mobile phone camera - scan the code below and download the Kindle app.
Follow the author
OK
Optimized C++: Proven Techniques for Heightened Performance 1st Edition
| Price | New from | Used from |
- Kindle
$38.49 Read with our free app - Paperback
$41.52 - $50.9916 Used from $30.52 16 New from $42.75
Purchase options and add-ons
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?”
- Locate performance hot spots using the profiler and software timers
- Learn to perform repeatable experiments to measure performance of code changes
- Optimize use of dynamically allocated variables
- Improve performance of hot loops and functions
- Speed up string handling functions
- Recognize efficient algorithms and optimization patterns
- Learn the strengths―and weaknesses―of C++ container classes
- View searching and sorting through an optimizer’s eye
- Make efficient use of C++ streaming I/O functions
- Use C++ thread-based concurrency features effectively
- ISBN-109781491922064
- ISBN-13978-1491922064
- Edition1st
- PublisherO'Reilly Media
- Publication date
2016
June 14
- Language
EN
English
- Dimensions
7.0 x 0.9 x 9.2
inches
- Length
385
Pages
Frequently bought together

Customers who viewed this item also viewed
Editorial Reviews
About the Author
Product details
- ASIN : 1491922060
- Publisher : O'Reilly Media; 1st edition (June 14, 2016)
- Language : English
- Paperback : 385 pages
- ISBN-10 : 9781491922064
- ISBN-13 : 978-1491922064
- Item Weight : 1.46 pounds
- Dimensions : 7 x 0.88 x 9.2 inches
- Best Sellers Rank: #2,122,308 in Books (See Top 100 in Books)
- #545 in C++ Programming Language
- #907 in Object-Oriented Design
- #2,572 in Software Development (Books)
- Customer Reviews:
Important information
To report an issue with this product, click here.
About the author

Discover more of the author’s books, see similar authors, read author blogs and more
Customer reviews
Customer Reviews, including Product Star Ratings help customers to learn more about the product and decide whether it is the right product for them.
To calculate the overall star rating and percentage breakdown by star, we don’t use a simple average. Instead, our system considers things like how recent a review is and if the reviewer bought the item on Amazon. It also analyzed reviews to verify trustworthiness.
Learn more how customers reviews work on Amazon-
Top reviews
Top reviews from the United States
There was a problem filtering reviews right now. Please try again later.
OTOH, sometimes this real experience is a bit, well, stale. For example, for measuring time intervals the book states that "on PCs, the fastest tick counters available have 100-nanosecond resolution" - which isn't true even for Windows which corresponding section heavily leans to (there is RDTSC instruction with ~1ns resolution for about 20 years now on all what can be named PC). In another example, in the whole chapter dedicated to strings I didn't find a reference to Small String Optimization (SSO), which is a reality for 5+ years now, and which changes performance analysis significantly. Advice "perform I/O in a separate thread" is also outdated in the modern days of generally-better-performing async I/O (at the very least, async I/O should be mentioned in this context).
Overall, I'd give this book 3.5 stars, but there is no such option - and given that books with real-world experience are rare, I decided to round it up rather than down.
A few concepts I was hoping for are missing, including vectorization (SSE, AVX), which is mentioned only in passing; more depth to floating point arithmetic; better discussion of memory and cache access patterns (the handling of the CPU cache in particular is so vague that there's no takeaway message that I could apply to my code); ...
Meanwhile, there's an excessive amount of time spent on a handful of topics, including timers (why are sundials and grandfather clocks given full paragraphs?) and, as others have said, the C++ language itself.
I was hoping this book would be a reference guide once I'd finished reading it, but a lot of the material wasn't quite concrete enough for it to be useful. I would highly recommend reading Agner's manuals instead if you have knowledge of C++ already. In some places they're a little bit dated but still solid and very much grounded in computer architecture. (Do a search, they're free online.)
1. It is really for people who does not know C++. Literally half of the book is explanation what is std::string and” don’t do too much in the loop”.
2. It seems to me author himself does not understand relatively basic things about C++ optimization ( e.g. why binary search on sorted array could be faster than hash map ). Some statement such as “always move declaration of a variable out of the loop” is just incorrect.
Advise for beginners – don’t buy this book. Learn from experts: Scott Meyers, Nicolai M. Josuttis, Antony Williams, Andrei Alexandrescu, Herb Sutter …
Top reviews from other countries
There is some interesting discussion of some C++-specific aspects, but not often in a very thorough or consistent manner. In the chapter about standard containers, the author gives a bunch of performance figures measured with some benchmark of his own, but the source code for the benchmark is unavailable, so you cannot try with your own compiler and standard library. Knowing that this or that has lackluster performance on Visual Studio 2015 doesn't help much if I'm targetting gcc 6 with the GNU libstdc++ on Linux.
In the part about memory management, there is this very vague statement "I have heard a rumor that both Windows and Linux have recently raised their game with state-of-the-art memory managers". Well... ok, you've heard a rumor, but you're writing and selling a book about optimized C++, so perhaps you should have gone and validate what the rumor says? I don't buy a specialized, technical book to learn about unconfirmed rumors!
As a more minor issue, I'm surprised that the author spends time discussing pre-C++11 idioms. This, in a book published in 2016.
I'm not a veteran C++ programmer, yet I feel I learnt too little by reading this book.
First, the author writes extensively (probably about half of the book in total) on basic C++ concepts that most readers should already know and/or concepts that are irrelevant to the topic of the book.
Second, when the author tries to provide potentially useful information, he discusses the topic in an inadequate way that is likely to leave readers scratching their heads in confusion.
Third, more than a few times the author wrote something that I knew to be incorrect or misleading.
Here are some examples of those second and third problems...
On pages 84-85, the author advocates the use of std::stringstream, but neglects to mention that this class performs lots of work in its constructor (apparently something to do with locales). I once obtained a significant optimisation in an application by removing as many instances of stringsteam as I could.
On page 97, the author advocates use of hash tables but neglects to mention that the heap allocation used in most hash table implementations is likely to increase cache misses (and hence reduce performance). He neglects to mention that there are some implementations of hash tables that use a large block of contiguous memory to be more cache friendly. (Do an Internet search for "flat hashmap" if you are interested in efficient hash tables.) The author mentions that a hash table lookup is O(1) in the common case and O(N) in the worst case, but never mentions the possibility of using a DFA, which is always O(1) lookup. Put simply, a DFA can be faster than a hash table, and this contradicts the author's claim that hash tables provide the fastest table lookup mechanism. The discussion on page 97 about hash tables would have benefited from mentioning the possibility of perfect hashes, but readers have to wait more than 100 pages (until page 224) for a mention of this.
On pages 123-124, the author mentions the possibility of storing a balanced binary tree in a contiguous array rather than in fragmented heap-allocated memory. This is a potentially useful thing to know but, unfortunately, the discussion of this topic is too superficial to be useful. In addition, he conflates two different opportunities for optimisation---(a) using a continuous array to avoid fragmented heap-allocated memory, and (b) using implicitly computed pointers/indexes rather than explicit pointers to parent/child nodes---into a single discussion and gives the incorrect impression that you must combine both opportunities together.
On page 150, the author mentions the possibility of iterating over an array backwards (that is, from length-1 to 0) rather than forwards (from 0 to length-1), but he neglects to warn that iterating backwards might be slower due to some CPUs implementing a forwards-looking-only cache prefetching mechanism. On my Intel-based laptop, iterating backwards over a multi MB array takes 25% more time than iterating forwards.
On pages 233-234, the author uses low-resolution timers to do a high-resolution performance test. The author tries to explain why this should work, but the explanation is too superficial and left me dubious.
On page 245, the author claims that, in most cases, the relative performance of two apps/algorithms when compiling in debug mode is similar to the relative performance when compiling in release/optimised mode. I was shocked at the author's naivety when I read this claim.
In summary, the book provides very little useful insight but lots of waffle and too much incorrect/bad advice to be recommended. Part-way through reading this book, I found a much better book called "Optimizing software in C++: An optimization guide for Windows, Linux and Mac platforms". You can find a free PDF of that book with an Internet search. It contains about half the pages and 10 times more insight than "Optimized C++".







