Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The general use-case is "high-performance and/or embedded systems." Games, and especially console games, happen to check both of those boxes. Another high-perf case is financial systems (eg: high-frequency trading). Other embedded systems would include things like robotics, automotive software, audio synthesizers and processing, etc.

Packing data into bits is a space optimization. On modern processors, accessing memory is hideously slow compared to doing logical operations, so if you can pack more info into fewer bits, you get higher information density, and need to access main RAM less often. Thus, it speeds things up, sometimes dramatically.

Sorry, I don't have reading material per-se.

But just as an anecdotal example: I was using some of this trickery to implement a densely-packed Quadtree using Morton Codes. Morton Codes interleave the bits of the X and Y coordinates for a cell on a grid. So, in order to break a M-Code apart and combine them back together, you need to "select the even bits" or "select the odd bits", which can be done with some tricks like these.

(aside: it's "piqued" :)



Thank you for the thorough break down. All the replies have immediately framed my "understanding" much more.

I'm not exactly sure why, but I'm very intrigued nonetheless.

Aside: TIL, Thanks!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: