hw-rankselect: Rank-select

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

Maintainers' corner

Readme for hw-rankselect-0.12.0.1

hw-rankselect

Efficient rank and select operations on large bit-vectors based on the paper
"Space-Efficient, High-Performance Rank & Select Structures on Uncompressed Bit
Sequences". This library does not yet implement the full cspoppy implementation.
Notably, it still uses the sub-optimal "Straw man" design for "Combined Sampling"
on page 10.

This library will use support for some BMI2 CPU instructions on some x86 based
CPUs if compiled with the appropriate flags on ghc-8.4.1 or later.

Rank and select

This library provides the following functions on indexed bit-vectors:

rank1

rank0

select1

select0

The supported indexed bit-vector types are:

Poppy512

CsPoppy

Constructing and using an indexed bit-vector in the repl

The example below constructs an indexed bit-vector from a string and runs
rank and select query operations on it. The bits in a string are in
little-endian and can be of arbitrary length. The resulting bit-vector
will be padded with 0-bits until the next 64-bit boundary.

Compilation

It is sufficient to build, test and benchmark the library as follows
for basic performance. The library will be compiled to use broadword
implementation of rank & select, which has reasonable performance.

Benchmark results

The following benchmark shows the kinds of performance gain that can
be expected from enabling the BMI2 instruction set for CPU targets
that support them. Benchmarks were run on 2.9 GHz Intel Core i7,
macOS High Sierra.