pub fn pack_tail(
values: &[u64],
width: usize,
output: &mut Vec<u8>,
) -> Result<()>Expand description
Packs fewer than VALUES values, sequentially and to a byte boundary.
The transposed layout is all or nothing. A value lives at a row and a lane, the lanes are interleaved through the whole buffer, and there is no prefix of a packed unit that holds a prefix of the values. So a unit holding 3 values costs the same as a unit holding 1024, which is 5 KB to store three numbers, and every nested array in a cascade is short: a dictionary of five entries, a run length array, an exception list.
This is the other layout for exactly those. It is the obvious sequential one, value 0 in the low bits, and it has the dependency chain the transposed layout was chosen to avoid. That is affordable here and only here: a tail is at most 1023 values and is decoded once, so the chain is bounded by a number that does not grow with the data, while a full unit is on the hot path of every scan in the system.
ยงErrors
If count is not below VALUES, if width exceeds 64, or if a value does not fit.