Celerity.Primitives 2.4.0

dotnet add package Celerity.Primitives --version 2.4.0
                    
NuGet\Install-Package Celerity.Primitives -Version 2.4.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Celerity.Primitives" Version="2.4.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Celerity.Primitives" Version="2.4.0" />
                    
Directory.Packages.props
<PackageReference Include="Celerity.Primitives" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Celerity.Primitives --version 2.4.0
                    
#r "nuget: Celerity.Primitives, 2.4.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Celerity.Primitives@2.4.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Celerity.Primitives&version=2.4.0
                    
Install as a Cake Addin
#tool nuget:?package=Celerity.Primitives&version=2.4.0
                    
Install as a Cake Tool

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 is internal-only.
  • FastUtils.CountDigits / Log10 — exact integer base-10 digit count for buffer sizing and column alignment (the BCL's LZCNT-based one is internal; Math.Log10 mis-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-method IRandomSource, with a zero-cost RandomSourceExtensions surface (NextDouble/NextInt/NextBytes/…). No heap, no virtual dispatch, no legacy seeded fallback like System.Random.
  • VarInt — span-based LEB128 + zig-zag Try(Write|Read) over Span<byte>, bounds-safe and allocation-free (the BCL's 7-bit codec is bound to BinaryReader/BinaryWriter).
  • FastGuid / GuidV7Generator — fast non-crypto random GUID v4 and RFC 9562 big-endian v7 (sortable, DB-index-friendly). Not for security — use Guid.NewGuid() for unguessable IDs.

See the utilities API reference for full docs and runnable examples.

License

MIT

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 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.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.4.0 0 7/26/2026
2.3.1-beta.15 0 7/25/2026
2.3.1-beta.8 38 7/23/2026
2.3.1-beta.2 45 7/22/2026
2.3.0 181 7/19/2026
2.2.1-beta.24 73 7/18/2026
2.2.1-beta.18 68 7/14/2026
2.2.1-beta.15 64 7/12/2026
2.2.1-beta.13 51 7/11/2026
2.2.1-beta.12 57 7/10/2026
2.2.1-beta.5 59 7/9/2026
2.2.1-beta.4 58 7/8/2026
2.2.1-beta.3 73 7/7/2026
2.2.1-beta.2 67 7/6/2026
2.2.0 130 7/5/2026
2.1.1-beta.4 52 7/4/2026
2.1.1-beta.2 73 7/2/2026
2.1.1-beta.1 62 7/1/2026
2.1.0 149 6/30/2026
2.0.1-beta.5 68 6/26/2026
Loading failed