Skip to content

Bit-Vector Bugfixes

Latest

Choose a tag to compare

@Cydhra Cydhra released this 10 Aug 08:59

Bugfixes

  • Appending 0 bits (as in "no bits" of an arbitrary word) to a BitVec using append_bits(x, n) did append garbage data to the internal representation which substantially increased the memory footprint. This was especially likely to happen on very dense EliasFano encodings, degrading its memory advantage.
  • Requesting 0 bits (as in no bits) of a vector using get_bits_unchecked(index, n) with an out-of-bounds index would access the vector out of bounds even though no memory access is required. This behavior was changed, and get_bits_unchecked now returns 0, even if the index is out of bounds to guard against edge cases in Elias-Fano. No code path could previously trigger this problem in Elias-Fano. The checked version has previously returned None without memory access and continues to do so.
  • successor0 did not work correctly for vectors with more than one super-block because it conflated an index and a block size constant, which could lead to the function returning an index in the first super block rather than the correct result.
  • successor0 could index a word outside the vector if a rank in a later super-block was requested and the function succeeded in using the rank support structure for the query.
  • The select support structure contained invalid sentinel values at the end of the structure. This was previously not an issue, but at some point the select functions started using the sentinel value as upper bounds during search which heavily degraded performance for sparse vectors on queries with high ranks. Correctness was never affected.
  • select1 implemented the binary search incorrectly, which degraded performance in sparse vectors. Correctness was never affected.