mccolljr / segvec

SegVec data structure for rust. Similar to Vec, but allocates memory in chunks of increasing size.
MIT License
33 stars 4 forks source link

segvec

docs.rs crates.io

This crate provides the SegVec data structure.

It is similar to Vec, but allocates memory in chunks of increasing size, referred to as "segments". This involves a few trade-offs:

Pros:

Cons:

Use Cases

  1. You have a long-lived Vec whose size fluctuates between very large and very small throughout the life of the program.
  2. You have a large append-only Vec and would benefit from stable references to the elements

Features

License: MIT