Succinct data structures use space close to the information-theoretic minimum while answering queries directly on the compressed representation. In this paper, we present a practical engineering study of rank and select queries on bit vectors. We evaluate a classic two-level block baseline (BlockBitVec), an asymmetric superblock implementation (FastBitVec), and an entropy-compressed representation (RRRBitVec) based on the Raman, Raman, and Rao (RRR) coding scheme. On Apple Silicon (M-series ARM architecture), we demonstrate a 1.4x speedup in rank queries through asymmetric 4096/256-bit block boundaries, with a rank index overhead of 7.8%. We investigate the empirical behavior of RRRBitVec and observe a symmetric density-dependent bell-curve for rank latency -- where queries at extreme densities (1% and 99%) run up to 39% faster due to offset elimination at boundary classes. We further show that RRRBitVec achieves a 4.9x speedup over classic binary-search select baselines, running in 33.7 ns at uniform density by using a superblock-level sampling index that restricts sequential scans to L1-cache lookups. All implementations are validated against a correctness fuzzer executing over 78 million assertions with no failures. Source code and test harnesses are publicly available.
翻译:简洁数据结构使用接近信息论下限的空间,同时在压缩表示上直接回答查询。本文针对位向量上的排名(rank)和选择(select)查询进行了一项实用性工程研究。我们评估了经典的二级块基线(BlockBitVec)、一种非对称超级块实现(FastBitVec),以及基于Raman、Raman和Rao(RRR)编码方案的熵压缩表示(RRRBitVec)。在苹果硅(M系列ARM架构)上,我们通过非对称4096/256位块边界展示了排名查询1.4倍的加速,且排名索引开销为7.8%。我们研究了RRRBitVec的经验行为,并观察到排名延迟呈现对称的密度相关钟形曲线——在极端密度(1%和99%)下,由于边界类别上的偏移消除,查询运行速度最多提高39%。我们进一步证明,通过使用超级块级采样索引(将顺序扫描限制为L1缓存查找),RRRBitVec在均匀密度下运行时长为33.7纳秒,相比经典二分查找选择基线实现了4.9倍的加速。所有实现均通过正确性模糊测试验证,该测试执行超过7800万次断言且未出现失败。源代码和测试框架已公开发布。