Slashdot Mirror


Hacker's Delight

Ben Olmstead writes with the review below of Henry S. Warren's Hacker's Delight, which is not about tricking folks into providing sensitive information, but rather about how to cleverly manipulate computers into doing more work on their part with less work on yours. Read on for his brief review. Hacker's Delight author Henry S. Warren Jr. pages 320 publisher Addison Wesley Professional rating Excellent reviewer Ben Olmstead ISBN 0201914654 summary Collected Tips & Tricks for Programmers

Hacker's Delight is an impressive compendium of clever tricks for programmers. Warren concentrates on micro-optimizations -- few of the tricks in this book operate on more than 3 or 4 words of memory -- and he displays an impressive knowledge of diverse computer systems in the process.

Who Should Read This Book

Hacker's Delight is hardcore in its presentation and subject matter. I would not recommend this for a beginning programmer -- to fully understand the material requires at least some knowledge of concepts such as Assembly and Machine languages. However, anyone who writes performance-critical software should read this book, even if they do not plan to write Assembly code, both to learn the tricks given, and to learn the concepts behind them.

What's Good

The book is organized into chapters where Warren presents related tricks. In each chapter, he presents a few tricks which perform related tasks -- for example, in Chapter 3, he presents tricks for rounding (up or down) to the next power of 2, rounding to a multiple of a known power of 2, and detecting power-of-2 boundary crossings (i.e., checking for page faults). For each trick, he discusses why it works, whether the technique is generally applicable, related tricks which might be better in specific situations, and where a trick might be used in the real world.

Warren keeps his discussion architecture-neutral, while noting optimizations and problems for specific architectures for specific tricks -- in the process, he displays a vast array of knowledge about specific processors, from 1960's mainframes to x86, MIPS, PPC, Alpha, and others. He also skims the surface of hardware-design issues in a few places -- for example, he devotes a page or two to explaining why computers use base 2 for arithmetic, and why this is the most efficient choice.

What's Bad

This is an extremely dense book, and there are sections which are difficult to understand. Furthermore, there are many tricks which, while interesting, would be difficult to apply to real-world applications, and use of these tricks does violate the Keep It Simple, Clock Cycles Are Cheap And Someone May Have To Understand Your Code philosophy which is harped upon so heavily (not without reason) in modern software design. However, someone writing a compiler or high-performance code may feel that the benefit outweighs the potential risk.

The Summary

If you want a better understanding of the hardware on which your code runs, or you need to squeeze clock cycles, or you just enjoy seeing clever tricks, this is an excellent book. If you primarily use high-level languages such as VB, perl, python, etc., this may not be the right book for you. Be prepared for very dense material.

You can purchase Hacker's Delight from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

3 of 178 comments (clear)

  1. Re:Sugar Hill Gang, anyone? by dasmegabyte · · Score: 0, Offtopic

    Offtopic? I think not. You can't review a book called "Hacker's Delight" and not have somebody do a bad parody of "Rapper's Delight." It's a given.

    But I suppose I can't expect your average slashdot moderator to understand the great works of old school hip hop.

    --
    Hey freaks: now you're ju
  2. Re:Dubious value? by First_In_Hell · · Score: 0, Offtopic
    Well said. I noticed that hackers/virus authors make horrible IT personel in the workplace. All they have learned is from fooling around, and there is no strong foundation in place.

    My company hired this guy who said he had a lot of computer expierence. He confessed to me that he had written viruses and hacked into other people's computers in his spare time. Suffice to say, the guy was a complete tool. He could not program for sh*t, and was constantly bothering me to give him work. I gave him nothing because;

    I did not trust him

    He had no foundation, everything he did was a kludge.

    Also there is no real-world application for hacking. Anyone who says that deserves to be butt-raped in jail.

  3. Re:I've read this book by Asprin · · Score: 0, Offtopic


    Whoever you are, you sure get around.

    --
    "Lawyers are for sucks."
    - Doug McKenzie