Celerity.Primitives
2.7.0
See the version list below for details.
dotnet add package Celerity.Primitives --version 2.7.0
NuGet\Install-Package Celerity.Primitives -Version 2.7.0
<PackageReference Include="Celerity.Primitives" Version="2.7.0" />
<PackageVersion Include="Celerity.Primitives" Version="2.7.0" />
<PackageReference Include="Celerity.Primitives" />
paket add Celerity.Primitives --version 2.7.0
#r "nuget: Celerity.Primitives, 2.7.0"
#:package Celerity.Primitives@2.7.0
#addin nuget:?package=Celerity.Primitives&version=2.7.0
#tool nuget:?package=Celerity.Primitives&version=2.7.0
Celerity.Primitives
Low-level, allocation-free primitives that fill genuine BCL gaps. Part of the Celerity family of high-performance .NET libraries.
Every type here ships only because it beats its BCL counterpart on a documented
workload — Celerity deliberately does not reimplement what
System.Numerics.BitOperations / TensorPrimitives already inline.
What's in the box
FastUtils.FastMod/FastDiv— Lemire reciprocal modulo & division by a runtime-constant divisor; 2–4× over%//for repeated mod by the same divisor (hash buckets, ring buffers, sharding). The BCL's equivalent isinternal-only.FastUtils.CountDigits/Log10— exact integer base-10 digit count for buffer sizing and column alignment (the BCL's LZCNT-based one isinternal;Math.Log10mis-rounds at exact powers of ten).FastUtils.NextPowerOfTwo— rounds up to the next power of two.- Struct PRNGs — value-type, seed-deterministic
SplitMix64,Xoshiro256StarStar,Xoroshiro128Plus,WyRand,Pcg32, all implementing the one-methodIRandomSource, with a zero-costRandomSourceExtensionssurface (NextDouble/NextInt/NextBytes/…). No heap, no virtual dispatch, no legacy seeded fallback likeSystem.Random. VarInt— span-based LEB128 + zig-zagTry(Write|Read)overSpan<byte>, bounds-safe and allocation-free (the BCL's 7-bit codec is bound toBinaryReader/BinaryWriter).FastGuid/GuidV7Generator— fast non-crypto random GUID v4 and RFC 9562 big-endian v7 (sortable, DB-index-friendly). Not for security — useGuid.NewGuid()for unguessable IDs.SortedSpan— set algebra over already-sorted spans:Intersect/Union/Exceptinto a caller-ownedSpan<T>, plus allocation-freeIntersectCount/Overlaps. The BCL has no set operation over spans at all, so the alternatives (HashSet<T>.IntersectWith, LINQIntersect) allocate a table and hash every element; a two-cursor merge is 4.2× faster at 1M × 1M with zero allocation, and 257× faster on the asymmetric 1k × 10M shape where it gallops. Inputs must be sorted ascending — unsorted input silently returns a wrong answer (asserted in Debug builds only).MortonCurve/HilbertCurve— space-filling curves: map a 2-D or 3-D integer coordinate to oneulongwhose ordering keeps nearby points nearby, and back.BitOperationshas no bit-interleave and the BCL has no Hilbert anything, so sorting a point set into a cache-coherent layout, packing a bounding-volume index, or building a tile key all start with hand-written magic numbers today. Morton is the cheap default; Hilbert costs a loop over the bit levels and buys the property Morton cannot give — consecutive indices are always neighbouring cells.
See the utilities API reference for full docs and runnable examples.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Celerity.Primitives:
| Package | Downloads |
|---|---|
|
Celerity.Collections
High-performance .NET dictionaries, sets, frozen/perfect-hash collections, and probabilistic sketches (Bloom, HyperLogLog, Count-Min) built on zero-cost struct hashers. As of the 2.0.0 split this package transitively pulls in Celerity.Hashing and Celerity.Primitives, so existing consumers keep working unchanged. |
|
|
Celerity.Hashing
Zero-cost struct hash providers and hash-quality tooling: IHashProvider<T>, integer/string/Guid hashers (identity, Wang, Murmur3, xxHash, SipHash, ...), DefaultHasher<T>, and the HashQualityEvaluator / ProbeStatisticsEvaluator offline analysis utilities. Positioned on distribution quality, determinism, and devirtualization — not on beating GetHashCode() for speed. Part of the Celerity family. |
|
|
Celerity.Sorting
Non-comparison sorts and selection over primitive keys: LSD RadixSort for (u)int/(u)long/float/double with key+payload and key+index (argsort) forms, CountingSort for bounded key ranges, and PartialSort quickselect / bounded-heap top-k. Span-based, with caller-supplied-scratch overloads that allocate nothing. Every entry point documents the crossover below which Array.Sort wins. Part of the Celerity family. |
|
|
Celerity.Statistics
Streaming summary statistics in bounded memory: DDSketch for relative-error quantiles over an unbounded stream, ReservoirSampler for a fixed-size uniform sample of a stream of unknown length (Algorithm L), and RunningStatistics for numerically stable single-pass mean / variance / skewness / kurtosis. The BCL ships no quantile, sampling, or higher-moment type at all. DDSketch merges bucket-exactly across shards (unless an operand has already collapsed) and RunningStatistics up to floating-point rounding; ReservoirSampler does not merge at all (a uniform merge needs a hypergeometric draw). The quantile, span and scalar query paths allocate nothing (enumerating the sampler as IEnumerable allocates an iterator, as it must); adding allocates only when a sketch ladder grows. Part of the Celerity family. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.7.1-beta.6 | 75 | 8/24/2026 |
| 2.7.1-beta.5 | 115 | 8/20/2026 |
| 2.7.1-beta.2 | 110 | 8/19/2026 |
| 2.7.0 | 999 | 8/18/2026 |
| 2.6.1-beta.13 | 96 | 8/18/2026 |
| 2.6.1-beta.10 | 84 | 8/15/2026 |
| 2.6.1-beta.6 | 87 | 8/14/2026 |
| 2.6.1-beta.3 | 86 | 8/11/2026 |
| 2.6.1-beta.2 | 73 | 8/10/2026 |
| 2.6.1-beta.1 | 86 | 8/9/2026 |
| 2.6.0 | 1,596 | 8/9/2026 |
| 2.5.1-beta.12 | 90 | 8/8/2026 |
| 2.5.1-beta.6 | 80 | 8/7/2026 |
| 2.5.1-beta.4 | 83 | 8/5/2026 |
| 2.5.1-beta.2 | 79 | 8/3/2026 |
| 2.5.1-beta.1 | 78 | 8/2/2026 |
| 2.5.0 | 1,395 | 8/2/2026 |
| 2.4.1-beta.13 | 79 | 8/1/2026 |
| 2.4.1-beta.12 | 80 | 7/31/2026 |
| 2.4.1-beta.11 | 80 | 7/30/2026 |