logo slogan

Title:Zen and the art of Code Optimisation

Author: Micheal Abrash

Publisher:Coriolis Group Books



Disk CD included


Another reviewer passed this book to me because it had “too much assembler”. It is not for the faint hearted. It is for those who need (not just think they would like) more speed. The title of the book is a hint “Zen of....” One has to have the correct frame of mind for this book. One also needs a knowledge of the hardware, assembler and algorithm as there is no attempt to teach basics. In fact is assumed that one has a reasonably good understanding of assembler to start with. Much of the book comes from the author’s column “Pushing the Envelope” in PC Techniques. The author's passion appears to be speed over all other criteria.


The whole Intel PC range from 8088 to the Pentium is covered. Also the Pentium's V-pipe. If you need to ask what a V-Pipe is then this book is probably not for you. The text works its way through the processors, looking at the known “cycle eating” areas and suggesting ways to deal with them. The book is full of tips and examples like “If any byte register is loaded, and then 2 cycles later any register is used to point to memory, 1 cycle is lost. So for example...” It is up to you to work out how and when to use these snippets in your own work.


Speed increases are given in cycles and also using a supplied precision timer. It is a library for linking into ones own code. This is an actuate timer with a range of up to 54miliseconds that can be used to measure performance improvements. 54Ms may not sound long but it highlights the tone of this book it looks very closely at small parts of code to save cycles. Also included on the disk are several versions of the game of life to illustrate various points.


I think experienced assembly programmers may take to this book. The average C coder will not because, as the book shows, to make real speed increases one has to drop into correctly optimised, hand crafted, assembler. There is not enough C++ in it to interest the C++ community. I found the book interesting to read but I did not take to it despite enjoying assembly programming and as the previous reviewer did not get on with it either I do not think it is a book would recommend.