On Tue, 7 Jul 2026 at 20:14, Heikki Linnakangas <
hlinnaka@iki.fi> wrote:
> Or maybe it's not a problem, in which case some kind of a
> worst case scenario benchmark to show that would be nice. Maybe test how
> it behaves when you have a lot of hash collisions, I think that'd make
> BufTableDelete() more expensive.
My additional benchmarking would suggest that, on average (one entry per bucket), the spinlock would be held for an extra ~50ns compared to releasing the header lock earlier for the current dynahash implementation:
Bucket Chain Length | Average Time Under Spinlock for Dynahash Implementation (ns) | Average Time Under Spinlock for New Table, Releasing Lock After Delete (ns) |
1 | 64.4 | 112.9 |
2 | 63.4 | 118.6 |
4 | 63.1 | 122.3 |
8 | 68.8 | 139.8 |
16 | 76.0 | 159.1 |
32 | 77.7 | 195.0 |
64 | 102.0 | 248.6 |
> If we are using a different data structure for buffer lookup,
> it will be good to consider ease of resizing as well.
Yes, we have internal functionality to resize (both shrink and expand) this restructured table without rehashing the entire table, acquiring a global lock, or introducing new synchronization primitives. Will create and share a follow-up patch going into more detail soon.
Thanks,
Dhruv Aron