View Source FastIntegerCompression (FastIntegerCompression v0.0.0)
This is an attempt at porting @lemire's FastIntegerCompression.js library to Elixir. The use case for this is to be able to compress things on the server side, and then push them to the frontend, where they can be properly decompressed, and vice versa.
The Fast Integer Compression algorithm uses VByte compression in order to compress a list of small integers into an array that uses far less bytes than the original.
The fastest path is using the submodules, FastIntegerCompression.Signed
and FastIntegerCompression.Unsigned
.
These are optimized to compress either signed or unsigned integers. However, they assume that the user has validated
that the integers are all correctly signed - i.e. if using FastIntegerCompression.Signed
, you may have both positive
and negative integers, however, using FastIntegerCompression.Unsigned
, you must have only positive integers.
Summary
Functions
@spec expected_number_of_integers(buf :: bitstring()) :: non_neg_integer()