I can't see how an algorithm to lookup bit 'i' in a compressed bitmap of size 'n' can ever be constant time.
What you do is decoding a block in constant time, as the block size is constant and you need exactly block size iterations. Using double here seems to be unsuitable for this kind of algorithm.
Agreed! But for the purpose of the post it is fine to use boost. Doing a constexpr function is definitely a plus for a production implementation. Also I don't see how your algorithm is constant time, unless you can write a bitmap class with a constant time operator[].
Decoding the block is constant. Accessing can be constant time, but is not if you encode implicitly the all-zeros/ones block. On the other and you can still do AND or OR between compressed bitmaps by paying only the scan. I wonder what is the benefit compared to RLE.
Benchmarking with other implementations is something I will definitely do in the future. jooster's comment seems to be valid too
Fixed that by using blocks of size 3 instead of 4. Sorry for the mistake. Please check the update, you will see it is even more compressed than before.
We benchmark against 10 other search APIs on fresh news queries. The median was around 1.2s; we came in around 166ms and scored highest on answer accuracy (89% vs 84% for the next cluster).
Latency matters because agents loop. A 1.2s first call eats the budget for follow-ups — you get one shot at framing the query. At sub-250ms the agent can actually search, read, reformulate, and search again.
Measuring this stuff carefully is something I've been at for a while. My ECIR 2019 paper (linked below) was an exhaustive study of 11 index compression methods across 5 query processing algorithms on standard collections — the codebase became PISA, which a lot of IR folks still use for research. Almost ten years later, the workload has changed completely (agents, not humans), but the benchmarking discipline is the same.
ECIR 2019 paper: https://www.antoniomallia.it/uploads/ECIR19c.pdf
Pisa Engine: https://github.com/pisa-engine/pisa
Full methodology and charts for Seltz: https://seltz.ai/blog/why-we-built-seltz