From 90cbf53a4b94b4a444b2a73a832c5d29c2ba08b6 Mon Sep 17 00:00:00 2001 From: Ed Guloien Date: Tue, 2 Jun 2026 18:06:14 -0400 Subject: [PATCH] added note on datastructure selection --- src/main.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main.rs b/src/main.rs index f0cfff2..e3435f7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,9 +29,17 @@ pub struct Blob { // where n is number of bytes // and m is number of ranges // ------------------------- + // Selected VecDeque>> 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 // and indexing into LinkedList nodes doesn't seem to jive well with Rust's ownership model // especially when considering multi-threaded access + // ------------------------- + // Vec>> 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>, // complexity variable n dropped: usize, ranges: Vec, // valid, global // complexity variable m