diff --git a/milli/src/update/new/extract/cache.rs b/milli/src/update/new/extract/cache.rs index 1e95d9cda..1b7a58472 100644 --- a/milli/src/update/new/extract/cache.rs +++ b/milli/src/update/new/extract/cache.rs @@ -9,7 +9,7 @@ use super::lru::Lru; use crate::update::del_add::{DelAdd, KvWriterDelAdd}; use crate::CboRoaringBitmapCodec; -const KEY_SIZE: usize = 8; +const KEY_SIZE: usize = 12; #[derive(Debug)] pub struct CboCachedSorter { diff --git a/milli/src/update/new/extract/lru.rs b/milli/src/update/new/extract/lru.rs index 7346c38af..3eca47cb2 100644 --- a/milli/src/update/new/extract/lru.rs +++ b/milli/src/update/new/extract/lru.rs @@ -121,8 +121,8 @@ struct FixedSizeListNode { #[derive(Debug)] struct FixedSizeList { nodes: Box<[Option>]>, - /// The first `None` in the nodes. - next_free: usize, + /// Also corresponds to the first `None` in the nodes. + length: usize, // TODO Also, we probably do not need one of the front and back cursors. front: usize, back: usize, @@ -132,7 +132,7 @@ impl FixedSizeList { fn new(capacity: usize) -> Self { Self { nodes: repeat_with(|| None).take(capacity).collect::>().into_boxed_slice(), - next_free: 0, + length: 0, front: usize::MAX, back: usize::MAX, } @@ -145,7 +145,7 @@ impl FixedSizeList { #[inline] fn len(&self) -> usize { - self.next_free + self.length } #[inline] @@ -168,8 +168,8 @@ impl FixedSizeList { if self.is_full() { None } else { - let current_free = self.next_free; - self.next_free += 1; + let current_free = self.length; + self.length += 1; Some(current_free) } }