View over lake Zurich- 1 Types of hash tables
- 2 Metrics
- 3 Lower bounds
- 4 Iceberg hashing (2023)
- 5 IcebergHT (2023)
- 6 Tight Bounds for Classical Open Addressing (2024)
- 7 Optimal Non-oblivious Open Addressing (2025)
- 8 Optimal Bounds for Open Addressing Without Reordering
- 8.1 Funnel hashing
- 8.2 Elastic hashing
- 9 Notes on filters
- 10 Papers
- 10.1 asd
- 10.2 (NO_ITEM_DATA:cuckoo-hashing-fast-insertion)
- 10.2.1 Bumping probability
- 10.2.2 Bumping distribution
- 10.2.3 Bloom filter quality for oracle=BFS
- 10.2.4 BFS bumping results (n=1M)
- 10.2.5 BFS query results
- 11 New ideas
\[ \newcommand{\inv}{^{-1}} \newcommand{\di}{\delta\inv} \newcommand{\poly}{\mathrm{poly}} \]
This post summarizes some recent results and idea on various types hash tables. Collected together with Stefan Walzer.
- “Iceberg Hashing: Optimizing Many Hash-Table Criteria at Once” (Bender et al. 2023)
- “IcebergHT: High Performance Hash Tables through Stability and Low Associativity” (Pandey et al. 2023)
- “Tight Bounds for Classical Open Addressing” (Bender, Kuszmaul, and Zhou 2024)
- “Optimal Bounds for Open Addressing without Reordering” (Farach-Colton, Krapivin, and Kuszmaul 2024; Farach-Colton, Krapivin, and Kuszmaul 2025)
- “Optimal Non-Oblivious Open Addressing” (Bender, Kuszmaul, and Zhou 2025a, 2025b)
1 Types of hash tables Link to heading
- Open addressing
- Elements are stored in a single (slot) array with no additional metadata.
- Stable
- As soon as an element is inserted, it does not move (apart from resizing).
- Greedy
- When inserting an element, the first empty slot found in the probe sequence is where it will go.
- Oblivious
- The probe sequence for a key \(x\) is \(h_1(x)\), \(h_2(x)\), \(\dots\), without depending on (meta)data in the hash table.
- Dynamic resizing
- The load factor is high at every point in time.
- Fixed-capacity
- The opposite of dynamic resizing, when the table is always near-full.
- Independent hash functions
- Some hash tables require fully random hash functions, while for others, $O(1)$-independence is enough.
2 Metrics Link to heading
- Universe size \(u\)
- Keys are chosen in \(0\leq k < u\). We may use \(w := \lg u = \lg_2 u\).
- Hash table size \(n\)
- The hash table contains \(n\) slots.
- Elements \(k\)
- We have \(k\) distinct keys.
- Load factor
- \(k/n = 1-\delta\) of the slots are filled. Also \(1-\varepsilon\) is used. I’ll call \(\delta=\varepsilon\) the slack or overhead, but neither seems standardized.
Generally, the goal of this line of research is to make dense hash tables with overhead as close to 0 as possible.
We can then measure query, insertion, and deleting time (together called operations). Almost always, an expectation over the random hashes is taken. Then, one can consider e.g. (from strong to weak):
- Constant time operations, with high probability1, and so this implies constant time in expectation.
- \(O(1)\) worst case expected time.
- \(O(1)\) amortized expected time.
3 Lower bounds Link to heading
- Static set
- The entropy of choosing \(n\) elements2 of \(u\) is \[\lg \binom un \approx n \lg u - n \lg n,\] ans this is a lower bound on the size of a hash table. In particular, this is less than the \(n \lg u\) bits needed to list the keys.
4 Iceberg hashing (2023) Link to heading
See Bender et al. (2023)
- \(\delta = o(1)\)
- stable, apart from resizing
- (Either resize in bulk, or de-amortize and be unstable for a while.)
- \(\lg \binom un + n \lg lg n\) space, which is optimal
- dynamic resizing
- \(O(1)\) queries whp
- \(1+o(1)\) cache misses
5 IcebergHT (2023) Link to heading
See Pandey et al. (2023)

Figure 1: Screenshot from Pandey et al. (2023).
6 Tight Bounds for Classical Open Addressing (2024) Link to heading
See Bender, Kuszmaul, and Zhou (2024).
Introduces rainbow hashing:
- \(O(1)\) expected-time queries,
- \(O(\lg \lg \di)\) expected-time insertions and deletions, and this is optimal.
- Also supports dynamic resizing, with no further cost.
- First work to have \(o(\di)\) complexity for all of insertion, deletion, and queries simultanuously.
7 Optimal Non-oblivious Open Addressing (2025) Link to heading
See Bender, Kuszmaul, and Zhou (2025b).
- \(\delta=0\), ie completely full table.
- Dynamic resizing.
- \(O(1)\) hash functions that are $O(1)$-wise independent.
Non-oblivious: information is stored in the order of the keys, and this is used to speed up probing. But how exactly?
Where there are \(n\) elements in an array, their order encodes \(\log n! = \Theta(n \log n)\) bits of information that we could exploit.
Universe reduction: if \(u = \Omega(\poly(n))\), when we can (whp) use a random hash function to injectively map all keys into a smaller universe of size \(u’ = \poly(n)\).
Partner hashing: This is the crux to using the stored elements. We can put a different element \(y\) in the preferred location of a key \(x\), and then \(x\) gets send to \(y\)’s location. But I haven’t fully understood the details yet.
8 Optimal Bounds for Open Addressing Without Reordering Link to heading
See also this earlier post.
8.1 Funnel hashing Link to heading
See (Farach-Colton, Krapivin, and Kuszmaul 2024).
- \(O(1)\) amortized probe complexity
- \(O(\log^2 \di)\) worst-case expected queries
- \(O(\log \di)\) (worst-case?) insertions?
8.2 Elastic hashing Link to heading
- \(O(1)\) amortized probe complexity
- \(O(\log \di)\) worst-case expected queries
- \(O(\log \di)\) (worst-case?) insertions?
9 Notes on filters Link to heading
- Xor filter: xor 3 random slots
- fuse filter: xor 3 slots from adjacent segments
- Binary Fuse Filter: segments have power-of-2 size
Given are \(n\) \(b\)-bit elements. Build a data structure that
9.1 Elias-Fano Link to heading
9.2 Bloom filter Link to heading
- https://lemire.me/blog/2021/10/03/word-aligned-bloom-filters/
- https://github.com/bacpop/sketchlib.rust/blob/main/src/hashing/bloom_filter.rs
9.3 Xor filter Link to heading
9.4 Ribbon retrieval Link to heading
9.5 Fuse filter Link to heading
9.6 Binary fuse filter Link to heading
9.7 Quotienting cuckoo hashing Link to heading
9.8 Cuckoo + 8-bit bumping filter Link to heading
10 Papers Link to heading
10.1 asd Link to heading
10.2 (NO_ITEM_DATA:cuckoo-hashing-fast-insertion) Link to heading
- try new priotized bumping & query algorithm
10.2.1 Bumping probability Link to heading
For each construction algorithm and load factor, the number of keys in its primary location. Last col: number of keys in its predicted location.
| Target load | random walk primary | §3 primary | §4 primary | §5 primary | §5 correct prediction |
|---|---|---|---|---|---|
| 80% | 91.41% | 89.49% | 89.49% | 89.48% | 89.48% |
| 90% | 83.19% | 77.84% | 77.84% | 77.90% | 79.60% |
| 95% | 74.00% | 64.65% | 64.65% | 64.65% | 75.15% |
| 98% | 62.69% | 46.67% | 52.47% | 53.19% | 73.00% |
| 99% | 56.09% | — | 45.97% | 48.31% | 72.40% |
| 99.5% | 51.87% | — | — | 40.91% | 72.56% |
10.2.2 Bumping distribution Link to heading
On n=1M keys; bins of size B=8.
- baseline: random walk
- oracle: exhaustive BFS search
- immediate: always check for all keys in a bin if they move to a non-full bin on overflow
95% load:
| Method | Mean | 0 | 1 | 2 | 3 | 4 | 5+ | p95 | |
|---|---|---|---|---|---|---|---|---|---|
| Baseline | 1.98 | 35.57% | 16.24% | 14.59% | 11.65% | 8.49% | 13.46% | 6 | |
| Oracle | 1.28 | 46.80% | 20.16% | 13.65% | 8.56% | 5.06% | 5.77% | 5 | * |
| §3 | 2.69 | 30.16% | 12.14% | 12.44% | 11.63% | 9.99% | 23.64% | 8 | |
| §4 | 2.69 | 30.16% | 12.14% | 12.44% | 11.63% | 9.99% | 23.64% | 8 | |
| §5 | 2.69 | 30.20% | 12.18% | 12.43% | 11.54% | 9.94% | 23.71% | 8 | |
| §4 immediate | 1.37 | 45.21% | 19.60% | 13.84% | 8.96% | 5.64% | 6.75% | 5 | * |
| §5 immediate | 1.32 | 46.33% | 19.69% | 13.56% | 8.75% | 5.34% | 6.33% | 5 | * |
98% load
| Method | Mean | 0 | 1 | 2 | 3 | 4 | 5+ | p95 | |
|---|---|---|---|---|---|---|---|---|---|
| Baseline | 2.93 | 19.74% | 14.10% | 15.18% | 14.37% | 12.10% | 24.51% | 7 | |
| Oracle | 1.58 | 36.55% | 22.96% | 15.94% | 10.52% | 6.40% | 7.63% | 5 | * |
| §3 | 4.18 | 14.99% | 8.55% | 10.42% | 11.46% | 11.62% | 42.96% | 10 | |
| §4 | 3.73 | 18.36% | 10.11% | 11.30% | 11.86% | 11.45% | 36.92% | 9 | |
| §5 | 3.67 | 18.93% | 10.22% | 11.40% | 11.91% | 11.35% | 36.19% | 9 | |
| §4 immediate | 1.99 | 30.71% | 20.27% | 16.21% | 12.10% | 8.31% | 12.40% | 6 | |
| §5 immediate | 1.82 | 33.42% | 21.08% | 16.07% | 11.39% | 7.57% | 10.47% | 6 |
46.80% + 20.16% + 13.65% + 8.56% + 5.06% + 10.77% 46.33% + 19.69% + 13.56% + 8.75% + 5.34% + 6.33%
10.2.3 Bloom filter quality for oracle=BFS Link to heading
Using the oracle’s full bumped-key histograms, averaged over all bins:
- 1hot, m bits: pₖ=1-(1-1/m)ᵏ.
- Two independent parts: square the corresponding 1hot probability.
- 2hot, m bits: pₖ=1-2(1-2/m)ᵏ+((m-2)(m-3)/(m(m-1)))ᵏ.
| Filter | Total bits/bin | 95% load | 98% load | |
|---|---|---|---|---|
| 1hot 64bit | 64 | 1.9558% | 2.4133% | |
| 2hot 64bit | 64 | 0.3357% | 0.4304% | |
| 3hot 64bit | 64 | 0.1270% | 0.1674% | |
| 4hot 64bit | 64 | 0.0746% | 0.1003% | |
| 5hot 64bit | 64 | 0.0575% | 0.0785% | |
| 6hot 64bit | 64 | 0.0528% | 0.0730% | * |
| 7hot 64bit | 64 | 0.0545% | 0.0760% | |
| 8hot 64bit | 64 | 0.0607% | 0.0851% | |
| (1hot 32bit)² | 64 | 0.3884% | 0.4950% | |
| 1hot 32bit | 32 | 3.8378% | 4.7310% | |
| 2hot 32bit | 32 | 1.2170% | 1.5538% | |
| 3hot 32bit | 32 | 0.7769% | 1.0140% | |
| 4hot 32bit | 32 | 0.6979% | 0.9231% | * |
| 5hot 32bit | 32 | 0.7480% | 0.9971% | |
| 6hot 32bit | 32 | 0.8788% | 1.1761% | |
| 7hot 32bit | 32 | 1.0804% | 1.4475% | |
| 8hot 32bit | 32 | 1.3536% | 1.8120% | |
| (1hot 16bit)² | 32 | 1.3971% | 1.7730% |
| k | (k-hot 32bit)², 95% | 98% | (k-hot 16bit)², 95% | 98% |
|---|---|---|---|---|
| 1 | 0.38842% | 0.49502% | 1.39713% | 1.77302% |
| 2 | 0.08034% | 0.10773% | * 0.74265% | * 0.97984% |
| 3 | * 0.05532% | * 0.07630% | 0.90976% | 1.21567% |
| 4 | 0.06259% | 0.08762% | 1.38284% | 1.84945% |
| 5 | 0.08757% | 0.12329% | 2.16349% | 2.88011% |
| 6 | 0.13289% | 0.18712% | 3.28770% | 4.34568% |
| 7 | 0.20550% | 0.28846% | 4.78265% | 6.27136% |
| 8 | 0.31443% | 0.43925% | 6.66226% | 8.66568% |
The best split choices are close to the best unsplit filters:
- 64 total bits: (3hot 32bit)² gives 0.05532% / 0.07630%, versus 6hot 64bit at 0.0528% / 0.0730%.
- 32 total bits: (2hot 16bit)² gives 0.74265% / 0.97984%, versus 4hot 32bit at 0.6979% / 0.9231%.
10.2.4 BFS bumping results (n=1M) Link to heading
| Table | Target load | Primary keys: walk → BFS | Filter passes: walk → BFS |
|---|---|---|---|
| Inline 1-hot | 95% | 71.2% → 81.5% | 2.93% → 1.91% |
| Inline 1-hot | 98% | 59.9% → 77.9% | 4.15% → 2.33% |
| Quotient 1-hot | 98% | 62.6% → 79.8% | 4.48% → 2.49% |
- Secondary locations are ~2x more rare
- Filters become sparser, because fewer keys are bumped.
10.2.5 BFS query results Link to heading
The completed BFS run shows a query-time benefit in return:
| Table | Load | Single-thread prefetch2 improvement | 192-thread improvement |
|---|---|---|---|
| Inline filtered | 95% | 14.6% | 5.8% |
| Inline filtered | 98% | 21.2% | 10.6% |
| Quotient + filtered | 95% | 13.5% | 4.4% |
| Quotient + filtered | 98% | 21.0% | 9.1% |
massive query time improvements :)
11 New ideas Link to heading
11.1 Quotienting bucketed cuckoo Link to heading
11.1.1 Done Link to heading
- \(m\) buckets of size \(b\)
- key \(x\) maps to \((mx)/2^{64}\) with stored value \(mx\bmod 2^{64}\)
- the stored value is prepended with a 1-bit for the secondary location
- use an 8-bit SIMD table filter or 16-bit filter inside the cache line
- 16-bit prefix seems best
- never insert values with remainder 0 so we can 0-pad and avoid storing a size
- instead, those always go in their secondary slot.
- we already use an invertable hash
- use that input range is bounded to 62-bit keys
TODO 11.1.2 Link to heading
- EF on ~10 values inside each cacheline
- use only a subset of the input key bits that still gives unique results?
- https://github.com/stefanfred/RoadrunnerHash
- https://reiner.org/cuckoo-hashing
- (NO_ITEM_DATA:engineering-cuckoo-hashing)
- ‘precise’ mode that has 1-byte aligned simd match and separate packed store of the remainders
- (NO_ITEM_DATA:blocked-bloom-filter-with-choices)
- Compare against Blocked Bloom Filters with Choices
- Compare against Sebastiano’s filter implementations
- (NO_ITEM_DATA:smaller-flexible-cuckoo-filters)
- IDEA: The choice-bit also contributes to the fp ratio!!!
- IDEA: Map each key to a window (with wrap-around?) of size 4 inside each cacheline-sized bin
-> reduces overhead of lg(B) bits to 2 bits!
- Then, instead of storing k+lg(B) bits, store k bits and use 2 bits for the position in the window.
- https://gitlab.com/rahmannlab/cuckoo-filters
- (NO_ITEM_DATA:cuckoo++)
- https://github.com/system-verification-lab/compact-parallel-hash-tables
- (NO_ITEM_DATA:compact-parallel-gpu-hash-tables)
- https://github.com/owensgroup/BGHT
- (NO_ITEM_DATA:better-gpu-hash-tables)
- (NO_ITEM_DATA:amq-space-lower-bound)
11.2 Idea: randomly map to a cache line, then optimal inside it Link to heading
- S bits per bin of size B
- poisson distribution over those
- \(a = \ln(2) \cdot S/B = 0.69 S/B\)
- FPR:
$$e-B ⋅ ∑k=1^∞ (B^k / k!) ⋅ 2-S/k = 2-S/B ⋅ (1
- a(a-2)/2B)$$
Table for the space overhead with \(S\) bit bins and target FPR \(2^{-k}\).
| k | S = 128 bits | S = 256 bits | S = 512 bits | S = 1024 bits |
|---|---|---|---|---|
| 4 | 1.27% | 0.62% | 0.31% | 0.15% |
| 8 | 11.07% | 5.54% | 2.77% | 1.39% |
| 12 | 29.14% | 14.58% | 7.33% | 3.68% |
| 16 | 56.82% | 27.81% | 13.93% | 7.01% |
| 20 | 97.51% | 45.77% | 22.62% | 11.37% |
| 24 | 157.20% | 69.49% | 33.55% | 16.75% |
| 32 | 381.14% | 141.42% | 63.36% | 30.76% |
| 64 | 25227.11% | 1861.84% | 417.45% | 150.69% |
References Link to heading
| Problem | diff | time of AC |
|---|---|---|
| D | 1% | 5 min |
| E | 5% | 10 min |
| G | 14% | 18 min |
| A | 22% | 25 min |
| K | 34% | 35 min |
| B | 53% | 50 min |
| H | 64% | 65 min |
| F | 76% | 85 min |
| C | 85% | 110 min |
| I | 93% | 150 min |
| L | 96% | 180 min |
| J | 98% | 210 min |
W.h.p. means with probability \(1-O(1/n^c)\) for every \(c>0\), assuming data-structure constants are suitably chosen dependent on \(c\). ↩︎
It’s a bit confusing that we have \(k\) keys in \(n\) slots but use \(n\) in such formulas. But since the load factor is close to \(1\), it doesn’t really matter. ↩︎