New week, new Rust! What are you folks up to?
I started working on making my BTreeMap "memory optimised", that is use as little memory as possible. This involves storing lengths in the parent, and is a little bit "messy" but should in the end reduce memory usage quite significantly. It also stores keys in a distinct array from values, which is should be more cache-friendly. btree_experiment/src/lessmem.rs at main · georgebarwood/btree_experiment · GitHub
struct Leaf<K, V, const N: usize> {
keys: MaybeUninit<[K; N]>,
vals: MaybeUninit<[V; N]>,
}
enum CA<K, V, const N: usize, const M: usize> {
L(MaybeUninit<[Box<Leaf<K, V, N>>; M]>),
NL(MaybeUninit<[Box<NonLeaf<K, V, N, M>>; M]>),
}
struct NonLeaf<K, V, const N: usize, const M: usize> {
leaf: Leaf<K, V, N>,
c: CA<K, V, N, M>,
clen: [u8; M],
}
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.