20130707 - Slab Hash


Something I decided not to use but wanted to write down for possible future reference. This idea isn't new either... Start with a slab size. Slab being some prime multiple of the size of a cacheline. Prime to increase cacheline set aliasing when cachelines of slabs are not always fully used. Take a large chunk of memory which has N slabs. Treat this memory as a hash table with something like MurmurHash3 as a hash function. Instead of traditional {key, pointerToData} which usually implies usually 2 cache misses even with no key collisions, store {key, data} in the slab (avoids a second cache miss).