flat_rbtree 0.1.2

A flat, index-based Red-Black Tree with no heap allocations. Ideal for performance-critical or memory-constrained environments.
Documentation

flat_rbtree

rust

A fast, index-based Red-Black Tree with no heap allocations — ideal for systems where performance and memory layout matter.

Features

  • Flat storage: all nodes are stored in a Vec, avoiding pointer indirection.
  • No allocations per node: avoids Box, Rc, or Arc.
  • No-std friendly: suitable for embedded environments.

Usage

let mut tree = RedBlackTree::new();
tree.insert(10, "A");
tree.update(10, "B");
tree.search(10); // Some(&"B")
tree.remove(10);

Benchmark: flat_rbtree vs rbtree (10,000 operations)

Operation flat_rbtree rbtree
Insert 1.93 ms (avg) 3.02 ms (avg)
Remove 2.49 ns 0.41 ns
Search 1.08 ms 0.88 ms

Results may vary depending on hardware and runtime conditions.

📝 License

This project is open-source under the MIT License.