Jump to ratings and reviews
Rate this book

The Art of Writing Efficient Programs: An advanced programmer's guide to efficient hardware utilization and compiler optimizations using C++ examples

Rate this book
Become a better programmer with performance improvement techniques such as concurrency, lock-free programming, atomic operations, parallelism, and memory management The great free lunch of "performance taking care of itself" is over. Until recently, programs got faster by themselves as CPUs were upgraded, but that doesn't happen anymore. The clock frequency of new processors has almost peaked, and while new architectures provide small improvements to existing programs, this only helps slightly. To write efficient software, you now have to know how to program by making good use of the available computing resources, and this book will teach you how to do that. The Art of Efficient Programming covers all the major aspects of writing efficient programs, such as using CPU resources and memory efficiently, avoiding unnecessary computations, measuring performance, and how to put concurrency and multithreading to good use. You'll also learn about compiler optimizations and how to use the programming language (C++) more efficiently. Finally, you'll understand how design decisions impact performance. By the end of this book, you'll not only have enough knowledge of processors and compilers to write efficient programs, but you'll also be able to understand which techniques to use and what to measure while improving performance. At its core, this book is about learning how to learn. This book is for experienced developers and programmers who work on performance-critical projects and want to learn new techniques to improve the performance of their code. Programmers in algorithmic trading, gaming, bioinformatics, computational genomics, or computational fluid dynamics communities will get the most out of the examples in this book, but the techniques are fairly universal. Although this book uses the C++ language, the concepts demonstrated in the book can be easily transferred or applied to other compiled languages such as C, Java, Rust, Go, and more.

464 pages, Paperback

Published October 22, 2021

38 people are currently reading
163 people want to read

About the author

Fedor G. Pikus

2 books3 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
14 (50%)
4 stars
11 (39%)
3 stars
2 (7%)
2 stars
1 (3%)
1 star
0 (0%)
Displaying 1 - 5 of 5 reviews
Profile Image for Nick Black.
Author 2 books879 followers
May 6, 2023
(full disclosure: i have been working on a book in the same general field for some time)

pretty well-written and up-to-date, generally free of canards and the tales of wives, very c++-focused, much more a collection of facts than e.g. performance analysis and tuning on modern cpus's top-down approach, very little on perf tools, surprisingly scant on compiler theory despite two chapters on "compiler optimizations" (not a mention of SSA so far as i remember), and the author at one point uses "NP-complete" where i'm 99% sure he ought use "undecidable". i mean, i'm absolutely sure he ought use "undecidable", but maybe i misunderstood the problem he was describing, which is about as undecidable as they come (correction email has been dispatched, but no response yet). with that said, this is probably a very fine guide for those setting out in search of perf and maxing it. for those who've been in the game for some time, it's not a required read, and nothing that hasn't been covered before.

pretty good text, though. i saw very little in the way of grammatical or continuity errors, which are so rife in modern textbooks. good job there.
Profile Image for Bugzmanov.
233 reviews97 followers
July 20, 2023
Between 4 and 5 stars.

The books consist of 3 parts:
- hardware specifics: CPU and memory.
- concurrency and multi-threading
- c++ specifics.

The first two parts are generally applicable to any language. Though concurrency in the environment without garbage collector has it's own peculiarities.
Usage of C++ is pretty basic and limited so the book can be read even without deep knowledge of c++.

I liked the focus on micro-benchmarks with constant caveats that micro-benchmarks might be misleading and not telling the full story.

Can't say that the topics being covered are unique to this book or that this book provides particularly good coverage, but it's a good package: it covers basics & fundamentals, it is short and it is a good intro. It's written in a very clean and concise language, that is super easy to follow. (Granted the book avoids talking about hairy topics)

A reader that has read (and understood) "Is Parallel Programming Hard, And, If So, What Can You Do About It?" can safely skip this one.
1 review
June 18, 2024
Outstanding book

Lots of excellent insight regarding designing and writing high performance software. I particularly enjoyed his explanations regarding coroutines. Will definitely be referring back to this book during my next project.
26 reviews
July 12, 2024
Pretty approachable description of the issues around writing high performance programs. Focuses both on single and multi threaded applications. Shows most common errors done in C++ which affect performance. Overall good technical book.
10 reviews
June 12, 2023
Good, but just wish Chapters 9 and 10 had a bit more to them. Has some overlap with C++ Concurrency in Action.
Displaying 1 - 5 of 5 reviews

Can't find what you're looking for?

Get help and learn more about the design.