News for hackers. Stuff that matters.
Re:Use perfect hashing, instead of binary search, for keywor... by senderista on Friday January 11, 2019 @04:06AM (#18881940)
Actually cache locality might not be quite as bad as you think: the first few levels of the "pivot tree" will definitely be cached (although wasting a whole cache line on a single element is certainly not optimal use of the cache). To get better locality one could use a breadth-first layout of the implicit binary search tree, like a binary heap. One compromise could be to duplicate the first few levels of pivots at the beginning of the array, in breadth-first order, while storing the array in the usual sorted order. See "Array Layouts for Comparison-Based Search" for more details.

There are no comments on this comment yet.