
Zen of code optimization
by Michael Abrash · first published 1994
45% recommend45% neutral9% critical
Why HN recommends it
Explains how to think about refining code and, just as importantly, where to stop once optimization is good enough; praised for clear, assembly-level explanations that made performance work click for programmers.
Summarised by Claude from recommending comments
Michael Abrash explores the inner workings of all Intel-based PCs including the hot new Pentium. This is the only book available that provides practical and innovative "right-brain" approaches to writing fast PC software using C/C++ and assembly language. This book is packed with "from the trenches" programming secrets and features "undocumented" Pentium programming tips. Provides hundreds of optimized coding examples.
Affiliate links. As an Amazon Associate I earn from qualifying purchases.








Michael Abrash - there's a name I haven't heard in a while! I remember his book back in the 90s Zen of Code Optimization completely changed how I looked at assembly language programming. I can easily imagine him doubling the Quake framerate!
on “How Michael Abrash doubled Quake framerate” ↗Abrash had[0] a way of explaining things that just clicked with me. His Zen of code optimization book really taught me how to think about refining my code. And where to stop refining when enough was enough. [0] I know he's still around. Just haven't read anything by him in forever it seems.
on “Black Book of Graphics Programming, Special Edition (1997)” ↗Probably Zen of Code Optimization. Good times.
on “An optimization guide for assembly programmers and compiler makers (2018) [pdf]” ↗Thanks for this and all your writing - the Zen of Code Optimization was a hugely inspirational book for me when I was younger, and is one of the main reasons I'm a programmer (even if it has instilled a slight paranoia about performance in everything I do). I'd love…
on “Michael Abrash on Quake: "Finish the product and you’ll be a hero."” ↗Absolutely. His Zen of Code Optimization is also a great book.
on “Which programming book you just couldn’t stop reading from start to end?” ↗You might be thinking of "Zen of Assembly Language" or "Zen of Code Optimization" by the brilliant Michael Abrash. I own the latter and in addition to plenty of low-level code optimization advice for the microprocessors available at the time it also includes timer code for DOS that…
on “Ask HN: How were video games from the 90s so efficient?” ↗…the Pentium was brand new. 80486 could do some instructions in parallel if you arranged them very carefully, and Pentium greatly boosted this capability. I used AMD CodeAnalyst (free) back then. I read Zen of Code Optimization by Mike Abrash which explained those particular microarchitectures very carefully. It may still be worth reading to understand how CPUs have evolved, but as this is uarch specific it will not be of great…
on “C Is Not a Low-level Language (2018)” ↗Zen of Code Optimization 1994 ( https://www.amazon.com/Zen-Code-Optimization-Ultimate-Softwa...) is the follow up to Zen of Assembly Language 1990 (https://www.amazon.com/Zen-Assembly-Language-Knowledge-Progr...)
on “An optimization guide for assembly programmers and compiler makers (2018) [pdf]” ↗Remember "The Zen of Code Optimization" by Michael Abrash in the 90s? This word count challenge was the first one he described. The table driven approach was discussed, but was not necessarily the fastest due to the large cache overflowing…
on “Wc2: Investigates optimizing 'wc', the Unix word count program” ↗…Graphics Programming book. It definitely isn't focused on a specific game, but it does go a bit into the BSP tree stuff used in Doom, if memory serves. Maybe it's just because I had already read both his Zen of {Code Optimization, Graphics Programming} books, but I was rather disappointed upon acquiring and skimming the Black Book. Fabien's deep dives are more interesting IMHO, if looking for stuff about tech in classic id games.…
on “Great books on classic video games” ↗VGA Mode is where the fun's at. Yeah, the start is essentially Zen of Code Optimization, which was also a great book, but pretty much dated in 2021... but it's interesting to see how he thinks. The best thing to take away is not about picking the right instructions, but to use your brain…
on “Great books on classic video games” ↗Pre-internet: Most programmers I knew had walls of books of reference material. Books like "PC Interrupts", the "386 system design guide", "Zen of Code Optimization" etc. And I didn't know many programmers. Computers were expensive and so was the software and reference books. I was lucky enough to be able to afford these things. Also, everything was just slower…
on “Ask HN: How has internet changed software development?” ↗