High-performance .NET collections that beat the BCL on documented workloads.
Celerity ships specialised dictionaries and sets with struct-based hashers, zero-cost generic dispatch, and continuous performance tracking on every commit. If a type doesn't outperform its System.Collections.Generic counterpart on a real benchmark, it doesn't ship.
dotnet add package Celerity.Collections
Latest measurement vs .NET BCL
Lookup
—
vs Dictionary / HashSet
Insert
—
vs Dictionary / HashSet
Remove
—
vs Dictionary / HashSet
What ships in the box
IntDictionary<TValue>int-keyed dictionary, default Wang hash.
LongDictionary<TValue>long-keyed dictionary, default Wang hash.
CelerityDictionary<K, V, H>Generic dictionary with a struct hasher constraint.
RobinHoodDictionary<K, V, H>Robin Hood open addressing: bounded probe variance for clustered keys.
SwissDictionary<K, V, H>Swiss-table SIMD group probing: one Vector128 compare tests 16 slots per lookup.
PooledCelerityDictionary<K, V, H>ArrayPool-backed, disposable dictionary that recycles its buffers to cut GC pressure.
FrozenCelerityDictionary<V>Build-once string-keyed dictionary with perfect hashing for single-probe lookups.
CelerityMultiMap<K, V, H>One-to-many map: each key groups multiple values. Implements
ILookup.SmallDictionary<K, V>Flat-array, linear-scan dictionary tuned for the very-small (n ≤ ~16) case.
IntSetint-keyed set, default Wang hash.
LongSetlong-keyed set, default Wang hash.
CeleritySet<T, H>Generic set with a struct hasher constraint.
FrozenCeleritySet<H>Build-once string set with perfect hashing for single-probe membership tests. Implements
IReadOnlySet.Celerity.HashingWang, Murmur3, FNV-1a, Guid, default fallback.
Design notes
Hashers are structs passed as generic constraints (
where THasher : struct, IHashProvider<T>) so the JIT devirtualizes and inlines Hash() on the probe path. Dictionaries implement IReadOnlyDictionary<TKey, TValue>, ship allocation-free struct enumerators, and handle default(TKey) out-of-band so the zero / null key never collides with the empty-slot sentinel. Celerity is single-threaded and does not guarantee iteration order — if you need either, use ConcurrentDictionary<,> or stay on the BCL.