#vec #data #disk

brk_vec

A very small, fast, efficient and simple storable Vec

5 releases

new 0.0.6 Mar 3, 2025
0.0.5 Mar 3, 2025
0.0.4 Mar 3, 2025
0.0.3 Mar 2, 2025
0.0.2 Feb 27, 2025

#553 in Database interfaces

Download history

172 downloads per month
Used in 6 crates (5 directly)

MIT license

36KB
950 lines

BRK Vec

A very small, fast, efficient and simple storable vec which uses mmap2 for speed.

Features

  • Get (Rayon compatible)
  • Push
  • Update
  • Insert
  • Remove

Disclaimer

Portability will depend on the type of values.

Non bytes/slices types (u8, u16, ...) will be read as slice in an unsafe manner (using std::slice::from_raw_parts) and thus have the endianness of the system. On the other hand, &[u8] should be inserted as is.

If portability is important to you, just create a wrapper struct which has custom get, push, ... methods and does something like:

impl StorableVecU64 {
    pub fn push(&mut self, value: u64) {
        self.push(&value.to_be_bytes())
    }
}

Dependencies

~4–12MB
~137K SLoC