Skip to content

Commit

Permalink
docs: reference VecBitmap for bulk loading
Browse files Browse the repository at this point in the history
The VecBitmap provides lower write latency at the cost of increased RAM
usage (it is effectively a normal bitmap).
  • Loading branch information
domodwyer committed Dec 13, 2024
1 parent 0600127 commit e033136
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ empty compared to a standard bloom filter.
* Maintains same false positive probabilities as standard bloom filters
* No 'unsafe' code

The CompressedBitmap maintains the same false-positive properties and similar
The `CompressedBitmap` maintains the same false-positive properties and similar
performance properties as a normal bloom filter while lazily initialising the
backing memory as it is needed, resulting in smaller memory footprints for all
except completely loaded filters.
Expand Down Expand Up @@ -45,7 +45,7 @@ bit and return immediately.
Lookups for indexes in populated blocks first check the block map bit, before
computing the offset to the bitmap block in the bitmap array by counting the
number of 1 bits preceding it in the block map. This is highly efficient as it
uses the `POPCNT` instruction on modern CPUs.
uses the `POPCNT` instruction on modern CPUs when available.

## Use case

Expand All @@ -57,6 +57,15 @@ lazily loads bitmap blocks from disk as they're accessed, while the frequently
accessed block map remains in memory to provide a fast negative response for
unpopulated blocks.

### Bulk Loading

To pre-load a bloom filter with a large amount of data, prefer using the
`VecBitmap` backing store for fast write throughput which is implemented as a
"normal" single-level bloom filter (true `O(1)` inserts).

Once loading is complete, it can be compressed to the `CompressedBitmap` storage
type to minimise RAM usage while retaining fast reads.

## Serialisation

Enable optional serialisation with the `serde` feature - disabled by default.
Expand Down

0 comments on commit e033136

Please sign in to comment.