finds.dev

lemire/javaewah

A compressed alternative to the Java BitSet class

View on GitHub

★ 568JavaApache-2.0updated Oct 2025

// the take

JavaEWAH is a compressed bitmap implementation for Java using the EWAH (Enhanced Word-Aligned Hybrid) run-length encoding scheme. It targets the specific use case where you have sparse-to-medium-density bit arrays over large integer ranges and need fast set operations. The format is what Git uses internally for pack-file bitmap indexes.

The production pedigree is real — Apache Hive, Spark, Eclipse JGit, and Twitter's algebird have all shipped this in anger. Memory-mapped file support via ByteBuffer backend is genuinely useful for bitmap indexes that don't fit in heap. The 32-bit and 64-bit variants give you a real tradeoff knob: 32-bit compresses better, 64-bit is faster on modern CPUs. The threshold function (mark bits set in at least T of N bitmaps) is a non-obvious but valuable operation for voting/quorum patterns that most bitmap libraries don't bother with.

EWAH has been largely superseded by Roaring bitmaps for general use — the README itself admits this and links to the competitor. Random bit access is slow by design; if you need `get(i)` in a hot path you're in the wrong data structure. The codebase is a near-complete mirror of the 32-bit and 64-bit variants (every class duplicated with a '32' suffix), which means any bug fix needs to land in two places — there's no generic abstraction. No support for long-valued elements, so you're capped at 2^31 - 1 as your maximum integer.

We read the README, the directory tree and a key source file in July 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
568
Forks
111
Language
Java
License
Apache-2.0
Last commit
21 Oct 2025

// nearby

If javaewah isn't quite it.

All repos →