Meziantou.Framework.BloomFilters
2.0.2
Prefix Reserved
dotnet add package Meziantou.Framework.BloomFilters --version 2.0.2
NuGet\Install-Package Meziantou.Framework.BloomFilters -Version 2.0.2
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="Meziantou.Framework.BloomFilters" Version="2.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Meziantou.Framework.BloomFilters" Version="2.0.2" />
<PackageReference Include="Meziantou.Framework.BloomFilters" />
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 Meziantou.Framework.BloomFilters --version 2.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Meziantou.Framework.BloomFilters, 2.0.2"
#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 Meziantou.Framework.BloomFilters@2.0.2
#: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=Meziantou.Framework.BloomFilters&version=2.0.2
#tool nuget:?package=Meziantou.Framework.BloomFilters&version=2.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Meziantou.Framework.BloomFilters
High-performance in-memory Bloom filters and counting Bloom filters for .NET.
Use BloomFilter when you need fast membership checks (Add + MayContain) and can tolerate false positives.
using Meziantou.Framework.BloomFilters;
// Configure the filter for ~1,000 items and 1% false positive probability
var size = BloomFilterSize.CreateOptimalSize(expectedItemCount: 1000, falsePositiveProbability: 0.01);
var filter = BloomFilter.CreateXXHash3(size);
filter.Add("alice@example.com");
filter.Add("bob@example.com");
if (filter.MayContain("alice@example.com"))
{
// Item may exist (no false negatives)
}
// Approximate number of inserted items
var estimatedItemCount = filter.GetEstimateCount();
Use CountingBloomFilter when you need to remove values or estimate per-value occurrences.
using Meziantou.Framework.BloomFilters;
var size = CountingBloomFilterSize.CreateOptimalSize(expectedItemCount: 1000, falsePositiveProbability: 0.01);
var filter = CountingBloomFilter.CreateXXHash3(size);
filter.Add("alice@example.com");
filter.Add("alice@example.com");
var mayContainAlice = filter.MayContain("alice@example.com"); // true
var estimatedCount = filter.GetEstimatedCount("alice@example.com"); // >= 2
filter.Remove("alice@example.com");
Available factory methods:
BloomFilter.CreateXXHash128,CreateXXHash64,CreateXXHash32,CreateXXHash3,CreateCrc64,CreateCrc32CountingBloomFilter.CreateXXHash128,CreateXXHash64,CreateXXHash32,CreateXXHash3,CreateCrc64,CreateCrc32
Supported value types include int, uint, long, ulong, Guid, string, Int128, UInt128, and ReadOnlySpan<byte>.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. net11.0 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- System.IO.Hashing (>= 10.0.10)
-
net11.0
- System.IO.Hashing (>= 10.0.10)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.