{
  "status": "shipping",
  "advantages": [],
  "limitations": [],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-17",
  "slug": "roaring-bitmap",
  "term": "Roaring bitmap",
  "aliases": [
    "Roaring bitmaps",
    "Roaring compressed bitmap"
  ],
  "definition": "Roaring is an exact integer-set representation that partitions identifiers into containers stored as sorted arrays, bitsets or runs.",
  "note": "Layout: Standard 32-bit Roaring groups unsigned identifiers by their high 16 bits. Each container represents the low 16 bits within one 65,536-value interval. Empty containers are omitted. [format]\n\nBoundary: For a non-run container, cardinality at most 4096 selects an array; larger cardinality selects an 8192-byte bitset. The array payload uses two bytes per value, so both payload sizes equal 8192 bytes at 4096. This threshold does not prohibit a run container above or below it. [format]\n\nClustering: A serialized run container with r runs uses 2 + 4r bytes. Thus 4096 consecutive values need a six-byte run payload, while 4096 separated singletons need 16,386 bytes if encoded as runs. These are container payloads, excluding stream headers, offsets and in-memory allocation. [format] [model]\n\nOperations: Container types shape intersection, union and difference algorithms. Runs help clustered identifiers, while scattered sets may favor arrays or bitsets. Run optimization can trade conversion work against space; smaller storage does not imply faster queries for every workload. [runs] [implementation]",
  "related": [
    "bitmap-index",
    "lossless-compression",
    "elias-fano"
  ],
  "citations": [
    {
      "id": "format",
      "title": "RoaringFormatSpec, pinned revision 188a7c75, standard 32-bit layout and container storage",
      "url": "https://github.com/RoaringBitmap/RoaringFormatSpec/blob/188a7c75a9cea6b2b6d31efb604fab621e6a1b28/README.md",
      "accessed": "2026-11-17"
    },
    {
      "id": "runs",
      "title": "Lemire, Ssi-Yan-Kai and Kaser, Consistently faster and smaller compressed bitmaps with Roaring, arXiv:1603.06549v4",
      "url": "https://arxiv.org/pdf/1603.06549v4",
      "accessed": "2026-11-17"
    },
    {
      "id": "implementation",
      "title": "Lemire et al., Roaring Bitmaps: Implementation of an Optimized Software Library, arXiv:1709.07821v6",
      "url": "https://arxiv.org/html/1709.07821v6",
      "accessed": "2026-11-17"
    },
    {
      "id": "model",
      "title": "Hesela: executable single-container payload accounting and exhaustive small-set tests (CC0)",
      "url": "https://hesela.dev/research/roaring-payload.test.mjs",
      "accessed": "2026-11-17"
    }
  ],
  "provenance": [
    "The worked examples are exact format arithmetic for synthetic sets, not CRoaring measurements or serialized whole-file sizes. [model]",
    "The standard 32-bit format is scoped separately from 64-bit extensions; implementations may have different in-memory layouts. [format]",
    "The 2016 journal article is consulted through its 2018 arXiv v4 revision; the implementation paper through its 2022 v6 revision. No performance result is reproduced."
  ]
}
