Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OffsetArrayLen ¶
func OffsetArrayLen(array OffsetArray) int
OffsetArrayLen is a helper function to access the length of an offset array. It is similar to calling Len on the array but handles the special case where the array is nil, in which case it returns zero.
Types ¶
type OffsetArray ¶
type OffsetArray interface { // Returns the value at index i. // // The method complexity may be anywhere between O(1) and O(N). Index(i int) uint64 // Returns the number of offsets in the array. // // The method complexity must be O(1). Len() int }
OffsetArray is an interface representing read-only views of arrays of 64 bits offsets.
func NewOffsetArray ¶
func NewOffsetArray(values []uint64) OffsetArray
NewOffsetArray constructs a new array of offsets from the slice of values passed as argument. The slice is not retained, the returned array always holds a copy of the values.
The underlying implementation of the offset array applies a compression mechanism derived from Frame-of-Reference and Delta Encoding to minimize the memory footprint of the array. This compression model works best when the input is made of ordered values, otherwise the deltas between values are likely to be too large to benefit from delta encoding.
See https://lemire.me/blog/2012/02/08/effective-compression-using-frame-of-reference-and-delta-coding/