diff --git a/documents/hash_tables_refs.md b/documents/hash_tables_refs.md new file mode 100644 index 0000000..3deb84b --- /dev/null +++ b/documents/hash_tables_refs.md @@ -0,0 +1,45 @@ +# Hash Tables References + +## SwissTable + +- [Designing a Fast, Efficient, Cache-friendly Hash Table, Step by Step](https://www.youtube.com/watch?v=ncHmEUmJZf4) +- [Abseil blog announcement](https://abseil.io/blog/20180927-swisstables) +- [Abseil design notes](https://abseil.io/about/design/swisstables) +- [Faultlore hashbrown-TLDR](https://faultlore.com/blah/hashbrown-tldr) +- [hashbrown source](https://github.com/rust-lang/hashbrown/tree/master/src/raw) +- [Faster Go maps with Swiss Tables](https://go.dev/blog/swisstable) + +### 64-bit hash from 128-bit hash +MurmurHash3 and SipHash return 128 bits. SwissTable expects 64 bits. XOR folding is the approach to use: + +```c +uint64_t fold_128_to_64(uint128_t hash) { + return (uint64_t)(hash >> 64) ^ (uint64_t)(hash & 0xFFFFFFFFFFFFFFFF); +} +``` + +## Robin Hood + +- [Celis (1986) — original paper proving O(1) variance, Θ(log n) max probe](https://cs.uwaterloo.ca/research/tr/1986/CS-86-14.pdf) +- [Gankra/Faultlore — clearest walkthrough from first principles](https://faultlore.com/blah/robinhood-part-1) +- [Sebastian Sylvan — popularized Robin Hood in systems programming](https://www.sebastiansylvan.com/post/robin-hood-hashing-should-be-your-default-hash-table-implementation/) +- [Emmanuel Goossaert — detailed C++ implementation + backward-shift deletion](http://codecapsule.com/2013/11/11/robin-hood-hashing/) +- [Martinus (Ankerl) — most widely used C++ implementation](https://github.com/martinus/robin-hood-hashing) +- [Tessil — clean header-only C++ implementation](https://github.com/Tessil/robin-map) +- [Malte Skarupke — Robin Hood with probe count limit](https://github.com/skarupke/flat_hash_map) + +## Robin Hood vs SwissTable + +- [Rust migration PR](https://github.com/rust-lang/rust/pull/56241) +- [hashbrown deletion discussion](https://github.com/rust-lang/hashbrown/issues/503) +- [Jackson Allan benchmark](https://jacksonallan.github.io/c_cpp_hash_tables_benchmark/) +- [Richter et al. (VLDB 2015)](https://bigdata.uni-saarland.de/publications/p249-richter.pdf) +- [Poblete & Viola (2018)](https://www.cambridge.org/core/journals/combinatorics-probability-and-computing/article/abs/analysis-of-robin-hood-and-other-hashing-algorithms-under-the-random-probing-model/933D4F203E3C70EF15053287412242E0) + +## Double Hashing + +- Knuth, TAOCP Vol. 3 §6.4 — definitive analysis of double hashing probe counts +- Guibas & Szemerédi (1978) — proved double hashing is asymptotically equivalent to uniform probing +- [Heileman & Luo (2005) — "How Caching Affects Hashing" — cache-aware experimental comparison](http://siam.org/meetings/alenex05/papers/13gheileman.pdf) +- [VT Hashing Tutorial — excellent pedagogical walkthrough](https://research.cs.vt.edu/AVresearch/hashing/double.php) +- [Paul Khuong — "The Other Robin Hood Hashing" (original Celis double-hashing variant)](https://www.pvk.ca/Blog/2013/11/26/the-other-robin-hood-hashing/)