Introduction

edit

Meziantou.Framework.BloomFilters provides Bloom filters: data structures that answer "is this value in the set?" using a small, fixed amount of memory, whatever the size of the values.

The answer is either "no" or "maybe":

  • No false negatives. When MayContain returns false, the value was never added.
  • Some false positives. When MayContain returns true, the value was probably added, but it may not have been. You choose the probability of this error when you size the filter.

A Bloom filter does not store the values, so it cannot list them. Use it in front of an expensive lookup, to skip the lookup for most of the values that are not there: a database query for a user name, a disk read for a key, a download of a URL already seen.

What you can do with it

Namespace

The types are in the Meziantou.Framework.BloomFilters namespace:

TypeContains
BloomFilterThe factory methods of Bloom filters, one per hash algorithm
BloomFilterSizeThe size of a Bloom filter: its number of bits and of hash functions
IBloomFilterThe methods of a Bloom filter, whatever its hash algorithm
CountingBloomFilterThe factory methods of counting Bloom filters
CountingBloomFilterSizeThe size of a counting Bloom filter: its number of counters and of hash functions
ICountingBloomFilterThe methods of a counting Bloom filter, whatever its hash algorithm
BlockedBloomFilterThe factory methods of blocked Bloom filters, which keep the bits of a value in one cache line
BlockedBloomFilterSizeThe size of a blocked Bloom filter: its number of 512-bit blocks and of bits set per value

Next steps