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.

11 of 178 comments (clear)

  1. Sounds like an interesting read... by Gortbusters.org · · Score: 5, Funny

    Almost as interesting as those lovely discrete math textbooks were. This sounds more like 'Optimizer's Delight.'

    To be honest, 'Hacker's Delight' sounded more like a cookbook title.

    --
    --------
    Free your mind.
    1. Re:Sounds like an interesting read... by swordboy · · Score: 1, Funny

      It also sounds like an interesting song:

      I said a hip hop the hippie the hippie
      to the hip hip hop, a you dont stop
      the hack it to the bang bang boogie say up jumped the boogie to the rhythm of the boogie, the beat

      --

      Life is the leading cause of death in America.
  2. omg by Anonymous Coward · · Score: 1, Funny


    i said a hip hop a hippie the hippie
    to the hip hip hop, a you dont stop
    a rock to the bang bang boogy say upchuck the boogy,
    to the rhythm of the boogity beat.

    now what you hear is not a test, i'm hacking to the motherfuckin beat
    and me, rob malda, and the rest are gonna try and move your feet
    see i am timothy and i'd like to say hello
    to the ACs, freaks, and logged-in kooks, and all the goatse trolls
    but first i gotta bang bang the boogie to the boogie
    say up jump the boogie to the bang bang boogie
    let's rock, you dont stop
    rock the rhythm that will make your body rock
    well so far youve heard my voice but i brought two friends along
    and next on the mike's my man hemos
    come on, hem, sing that song

    1. Re:omg by FireballFreddy · · Score: 2, Funny

      Don't worry bud, I agree with you. That's funny shit. :) I'll stand by your side. Bring it on, you mod-punks with no sense of humor!

      You know, the post was offtopic but funny... shouldn't that average out to "Neutral +0"?

      -FF

      --
      SQUEAK, the Death of Rats explained.
  3. Hacker delight.... by Jethro+On+Deathrow · · Score: 4, Funny

    ...is the exact oposite of afternoon delight, I would imagine.

    1. Re:Hacker delight.... by Lt+Razak · · Score: 2, Funny

      True. When you see a hacker at work at 7 a.m., it's not because he came in early. It's because he hasn't left work yet.

  4. Sugar Hill Gang, anyone? by dasmegabyte · · Score: 5, Funny

    I said a hip, hop, hippy, hippy to the hip hop hacking you don't stop a hacking until the bang bin boogie said backslash the boogie to the rhythm of the boogity beat..

    What you hear is not a test, I'm hacking to the beat. And me, the compiler, and my code are gonna start to move your screen.

    See, I am das MB and I'd like to say hello
    To the linux loners and the mac fairys and the losers on windows.

    But first I gotta..bang slash bin slash P E R L said hack kernel yes hack hack the kernel until the whole machine runs like hell.

    Proper.

    --
    Hey freaks: now you're ju
  5. Be Wary by OldStash · · Score: 4, Funny

    manipulate computers into doing more work on their part with less work on yours

    To paraphrase the great Terry Pratchet: "Beware labour saving devices which are smaller than their manuals".

  6. My computer won't work hard enough by Toe,+The · · Score: 2, Funny
    I tried all kinds of tricks to get my computer to work harder. And whaddya know, one night it patched its speech software into the modem and called the union on me.

    Ingrate! If it weren't for me, it'd be running gene sequences all day and night. Computers have no sense of perspective.

  7. the most important thing by pummer · · Score: 1, Funny

    will it teach me how to hack Windows ME??? It's so hard -- I can't figure it out!

  8. Whoa! by mschoolbus · · Score: 2, Funny

    3313 bytes in body

    I almost thought that was 31337 or something!