Get the latest tech news
SIMD within a register: How I doubled hash table lookup performance
It started with a simple thought: four bytes in a hash table bucket look just like an integer. Luckily, this one idea led to a deep dive into bit-twiddling and a 2x performance boost.
To keep the rest of the code clean, all table logic lives in its own class, whose heart is a pre-allocated byte array: So no, nothing breaks, the algorithm is still robust: HasZero only gives a positive result if a zero byte exists after the XOR, which only happens if our target fingerprint was in the bucket to begin with. I’m still not a huge fan of stuffing dense bit tricks into production C#—they can be hard to read and even harder to maintain if something goes wrong.
Or read this on Hacker News