[HN Gopher] Hacker's Delight (2012) ___________________________________________________________________ Hacker's Delight (2012) Author : kjhughes Score : 120 points Date : 2022-08-07 13:43 UTC (9 hours ago) (HTM) web link (books.google.com) (TXT) w3m dump (books.google.com) | tintedfireglass wrote: | Nice book but I feel the title should be something like | principles of computer science or something of that sort. | jxi wrote: | FabHK wrote: | _Programming Tricks Close to the Metal_ seems more appropriate. | brianrisk wrote: | This is a nice title! At the very least a new book should be | written to use it. | djmips wrote: | People on a site called Hacker News complaining about the name of | a book called Hacker's Delight. | KingOfCoders wrote: | Bioshock! | O__________O wrote: | TDLR: Author systematically collected little programming tricks, | thematically organized them, and clearly explains them. | [deleted] | fefe23 wrote: | Compilers have improved a lot, to the point where you don't need | to read this book for many of the tricks. For example, if you | divide by a constant in gcc, you can see the tricks from this | book being applied if you look at the disassembly. | | Still, this is a standard textbook for little tricks. Knowing | these kind of tricks used to be enough to make you a hacker in | the original sense. I greatly enjoyed reading it and still | recommend it even today. | | It really is a delight for hackers. | anonymoushn wrote: | The section on computing magic numbers for integer division is | quite useful if you find yourself implementing a vectorized | version of an algorithm that calls for integer division or | integer modulus, since these instructions typically don't exist | mhh__ wrote: | Note that some fairly big hardware didn't have them either. | | Itanium and DEC Alpha didn't have integer divide IIRC. | | Cheap RISC-V also probably won't. | fanf2 wrote: | I have copies of both the first and second editions of Hacker's | Delight. The second edition is mostly the same, but with a few | additions and corrections. (Also printed on thicker paper with a | smaller text area so it looks 2.2x thicker for 1.1x the content.) | | I use it occasionally for things like optimizing tolower() | https://news.ycombinator.com/item?id=31900872 and for popcount | hacks https://dotat.at/prog/qp or for quickly updating a log- | linear histogram https://dotat.at/@/2022-07-15-histogram.html | cbisnett wrote: | This is a really great book for anyone interested in compiler | development, JIT compilation of higher-level languages, reverse | engineering, or anything that involves understanding or | generating assembly instructions. This is not a book about | hacking from the perspective of breaking into systems or finding | and exploiting vulnerabilities in software. The term Hacker in | the title is a reference to an early meaning of the word that | referred to someone who liked to tinker and understand how things | worked. | | When I was doing a lot of reverse engineering and vulnerability | research work this book gave some really great insight into some | of the compiler optimizations that I would come across. Highly | recommended for anyone trying to take their skills to the next | level. | FabHK wrote: | You might be thinking about a different book? Hacker's Delight | is mostly about bit fiddling (counting bits, finding the | longest string of 1-bits, multiplication and division, Gray | code, CRC, the famous approximate reciprocal square root) and | such. | EdwardCoffin wrote: | These are just the kinds of things that an optimizing | compiler can use, so would be quite useful for reverse | engineering the product of an optimizing compiler to figure | out what it is doing. | smrtinsert wrote: | I have my physical copy of this around somewhere | 2OEH8eoCRo0 wrote: | Mine taunts me in plain view from my bookshelf. It's a cool | book but I have little use for what it provides so I haven't | been able to dig into it much. | davegauer wrote: | Ha ha, this falls firmly into the "I _wish_ I needed to | reference this more " category for me as well. | mabster wrote: | When I was doing low-level optimisation for games (lots of | SIMD), I was using mine quite frequently. | | Now that I'm doing more application development it's sitting | on my bookshelf looking neglected. | mtlmtlmtlmtl wrote: | Same. But sometimes I like skimming it just as a distraction. | There's something so satisfying about seeing these tricks I'm | far too stupid to come up with on my own. A couple of times, | I've had some breakthroughs when stuck on an unrelated | problem, while reading this book, because the "psychedelic | hackery" sort of leads me down an alley I wouldn't otherwise | have thought of, due to some superficial similarity. | kevin_thibedeau wrote: | I use mine on occasion. It's particularly useful when | targeting architectures that don't have modern intrinsics for | special operations. | | It's worth noting that some of the solutions aren't optimal | for modern devices with conditional moves. In some cases you | can get equal or better performance with straightforward code | than some of the stuff in the book that goes out of its way | to avoid branching control flow. | AlotOfReading wrote: | It has a pretty cool niche as a set of toy problems to | verify cryptography tooling and I've found some of the | recipes inside useful inspiration for constant time | programming and other constrained domains. It's not as | useful as it used to be for exactly the reasons you | mentioned though. | huqedato wrote: | A fine book with a very misleading name. The book is about basic | computer science and algorithms. | night-rider wrote: | Reminded me of Smokers Delight by Nightmares on Wax: | https://www.last.fm/music/Nightmares%20on%20Wax/Smokers%20De... | fknorangesite wrote: | And Rapper's Delight before that. | brianrisk wrote: | I hear all of you about how it's not misleading, but I must | admit that when I clicked on this link I was expecting a | different kind of book. | AlotOfReading wrote: | It's not misleading, it's just an older meaning of the word | "hacker" and one that still exists in the name of this site. | Hacker's delight is a spiritual successor to the HAKMEM memo | from the 70s. Guy Steele even wrote the foreword. | SeanLuke wrote: | The term hacker has a long and storied history. A hacker is | someone who makes hacks. A hack is a thing, typically a piece | of code, which must be appreciated for its aesthetic beauty, | regardless of whether it's particularly useful. [This term was | obviously originally used sarcastically]. People strove to | become hackers. It was a badge of honor. | | In the 1980s the term "hacker" was possibly conflated with | "cracker" by stupids in the media, and came to mean a software | pirate or kid who broke into the Pentagon. But the proper | meaning still hasn't been lost with the graybeards among us. ___________________________________________________________________ (page generated 2022-08-07 23:00 UTC)