{
  "status": "research",
  "advantages": [],
  "limitations": [],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-17",
  "slug": "gorilla-compression",
  "term": "Gorilla compression",
  "aliases": [
    "Gorilla XOR encoding"
  ],
  "definition": "Gorilla compression represents time-series timestamps by delta-of-delta encoding and values by XOR differences with preceding values.",
  "note": "Mechanism: A zero value XOR needs one bit; a changed value either reuses a stored bit window or describes a new one. Timestamp and value encodings are separate. [paper]\n\nWindow cost: For a stored width of 64 bits and a new one-bit residual, containment-only reuse costs 66 bits; fresh metadata costs 14. The Beringei implementation checks cost as well as containment. The linked synthetic ledger isolates this decision, not full-stream size. [code] [ledger]\n\nRestarts: In the ledger, 64 identical values need 127 payload bits in one block or 190 across two blocks. Smaller restart units can increase payload while reducing how much preceding state a read must reconstruct. [ledger]\n\nFormat: The paper and Beringei source use different control-bit conventions. An algorithm name alone does not establish byte compatibility. [paper] [code]",
  "related": [
    "chimp-compression",
    "lossless-compression",
    "delta-encoding"
  ],
  "citations": [
    {
      "id": "paper",
      "title": "Pelkonen et al., Gorilla, PVLDB 8(12), 1816-1827 (2015), section 4.1",
      "url": "https://www.vldb.org/pvldb/vol8/p1816-teller.pdf",
      "accessed": "2026-11-17"
    },
    {
      "id": "code",
      "title": "Facebook Beringei: appendValue and readNextValue, pinned 75c3002",
      "url": "https://github.com/facebookarchive/beringei/blob/75c3002b179d99c8709323d605e7d4b53484035c/beringei/lib/TimeSeriesStream.cpp",
      "accessed": "2026-11-17"
    },
    {
      "id": "ledger",
      "title": "Hesela: exact XOR-window and restart accounting",
      "url": "https://hesela.dev/research/xor-window/README.md",
      "accessed": "2026-11-17"
    }
  ],
  "provenance": [
    "Paper DOI: 10.14778/2824032.2824078. The 2015 system and its workload results are distinct from a portable encoding specification.",
    "The ledger counts synthetic value payloads only. Timestamp bits, framing, terminators, byte padding and indexes are excluded; no native compressor or throughput benchmark was run.",
    "Beringei's first-value handling also differs from the ledger's raw 64-bit initialization. The cost guard is a local decision, not proof of a globally minimal stream. [code]"
  ]
}
