Skip to main content

Module compact_vec

Module compact_vec 

Source
Expand description

CompactVec - A 16-byte vector optimized for Row storage

Standard Vec<T> is 24 bytes (ptr + len + cap as usize). CompactVec<T> is 16 bytes (ptr + packed len/cap as u32).

Benefits:

  • 33% smaller than Vec (16 vs 24 bytes)
  • O(1) len() access (unlike ThinVec which requires dereference)
  • Faster moves due to smaller size
  • Supports up to 4 billion elements (u32::MAX)

Structs§

CompactVec
A compact vector that uses 16 bytes instead of Vec’s 24 bytes. Stores length and capacity as u32 (max 4 billion elements).
Drain
Drain iterator for CompactVec. Removes elements from the vector as they are iterated.
IntoIter
Owning iterator for CompactVec.