A thread-safe string pool that deduplicates strings into a PerThreadBumpPtrAllocator.
More...
template<size_t ShardBits = 10, uint32_t InitialSlabCapacity = 256, uint32_t ProbeWindow = 8, size_t NumLevels = 15>
class clang::doc::ConcurrentStringPoolImpl< ShardBits, InitialSlabCapacity, ProbeWindow, NumLevels >
A thread-safe string pool that deduplicates strings into a PerThreadBumpPtrAllocator.
Keys are sharded by the upper bits of their hash. Each shard holds an array with a power-of-two number of slabs which are allocated on demand via LazyAtomicPointer. Lookups probe a small window in each slab and move to the next level when the window is full, avoiding locks and table rehashing.
- Template Parameters
-
| ShardBits | Number of upper hash bits used to select a shard (1..31). |
| InitialSlabCapacity | Power-of-two capacity of level 0. |
| ProbeWindow | Linear probe window per level (1..InitialSlabCapacity). |
| NumLevels | Number of doubling slab levels per shard; the largest slab (InitialSlabCapacity << (NumLevels - 1)) must not exceed 2^(32 - ShardBits), the bits of ProbeHash not consumed by ShardBits. |
Definition at line 55 of file ConcurrentStringPool.h.
template<size_t ShardBits = 10, uint32_t InitialSlabCapacity = 256, uint32_t ProbeWindow = 8, size_t NumLevels = 15>