added note on datastructure selection
This commit is contained in:
@@ -29,9 +29,17 @@ pub struct Blob {
|
|||||||
// where n is number of bytes
|
// where n is number of bytes
|
||||||
// and m is number of ranges
|
// and m is number of ranges
|
||||||
// -------------------------
|
// -------------------------
|
||||||
|
// Selected VecDeque<Box<[u8;N]>>> for fast push/pop/access
|
||||||
|
// pop_front may re-allocate, but better than vector most of time
|
||||||
|
// also since we use box, we are only copying pointers to the arrays, not each u8
|
||||||
|
// -------------------------
|
||||||
// also tried using LinkedList, but slow reading when ranges were inside nodes
|
// also tried using LinkedList, but slow reading when ranges were inside nodes
|
||||||
// and indexing into LinkedList nodes doesn't seem to jive well with Rust's ownership model
|
// and indexing into LinkedList nodes doesn't seem to jive well with Rust's ownership model
|
||||||
// especially when considering multi-threaded access
|
// especially when considering multi-threaded access
|
||||||
|
// -------------------------
|
||||||
|
// Vec<Option<Box<[u8;N]>>> also worth considering, but instead of pop
|
||||||
|
// using None slots to maintain indexes, if arrays are likely to be sparse
|
||||||
|
// this would probably be preferrable
|
||||||
arrays: VecDeque<Box<[u8; ARRAY_SIZE]>>, // complexity variable n
|
arrays: VecDeque<Box<[u8; ARRAY_SIZE]>>, // complexity variable n
|
||||||
dropped: usize,
|
dropped: usize,
|
||||||
ranges: Vec<Range>, // valid, global // complexity variable m
|
ranges: Vec<Range>, // valid, global // complexity variable m
|
||||||
|
|||||||
Reference in New Issue
Block a user