This package implements Roaring bitmaps in Go for compressed sets of integers with fast intersections, unions, and membership checks. It is used in production systems and can exchange serialized bitmaps with Java and C/C++ implementations.
Overview
The library provides the Roaring bitmap data structure as a Go package for representing sets of integers with less memory than naive bit vectors while keeping operations fast. It targets index and database workloads where you need to add or remove document or row identifiers and compute intersections, unions, and differences between large sets.
Roaring splits the integer space into 65,536-value chunks and stores each chunk as an uncompressed bitmap, a sorted array, or a run-length encoding, enabling random access and faster operations than older run-length-encoded formats such as WAH, EWAH, and Concise.
Installation is via go get on the GitHub module. The default build handles unsigned 32-bit integers; an extension package supports 64-bit integers with a similar API, though only the 32-bit format is standardized for cross-language portability. Serialized bitmaps can be saved and loaded, with helpers to estimate size and optimize container encoding.
The Java, C, C++, and Go implementations are binary compatible for the standard 32-bit format, with a published format specification. Named downstream users include search engines, databases, observability stacks, and streaming systems, including InfluxDB, Bleve, and DataDog.
Key features
- Compressed integer sets
- Set intersection and union
- Fast membership checks
- Cross-language serialization
- 32-bit and 64-bit variants
- RunOptimize compact encoding
- Vim errorformat parsing support
- Production use in search and DB stacks
Use cases
- Database and search indexes
- Document ID set operations
- Inverted index posting lists
- Memory-efficient filter bitmaps
- Cross-language bitmap exchange