From 52d7f3ed1ce0f85f3e927460f64356e9910bc2ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Wed, 25 Sep 2024 15:37:13 +0200 Subject: [PATCH] Reduce the lru key size from 20 to 8 bytes --- milli/src/update/new/extract/cache.rs | 2 +- milli/src/update/new/extract/lru.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/milli/src/update/new/extract/cache.rs b/milli/src/update/new/extract/cache.rs index 4f6f30e70..1c7db0473 100644 --- a/milli/src/update/new/extract/cache.rs +++ b/milli/src/update/new/extract/cache.rs @@ -11,7 +11,7 @@ use crate::CboRoaringBitmapCodec; #[derive(Debug)] pub struct CboCachedSorter { - cache: Lru, DelAddRoaringBitmap>, + cache: Lru, DelAddRoaringBitmap>, sorter: Sorter, deladd_buffer: Vec, cbo_buffer: Vec, diff --git a/milli/src/update/new/extract/lru.rs b/milli/src/update/new/extract/lru.rs index 7c13d9350..cfec6e157 100644 --- a/milli/src/update/new/extract/lru.rs +++ b/milli/src/update/new/extract/lru.rs @@ -59,10 +59,10 @@ impl Lru { Entry::Vacant(vac) => { let key = vac.key().clone(); if self.storage.is_full() { - let idx = self.storage.back_idx(); // It's fine to unwrap here because: // * the cache capacity is non zero // * the cache is full + let idx = self.storage.back_idx(); let node = self.storage.move_front(idx).unwrap(); let LruNode { key, value } = mem::replace(node, LruNode { key, value }); vac.insert(idx); @@ -128,8 +128,8 @@ struct FixedSizeList { // to find a free place. // TODO remove the free list as it is always growing: // we cannot remove entries from the map. - // Also, we probably do not need one of the front and back cursors. free: Vec, + // TODO Also, we probably do not need one of the front and back cursors. front: usize, back: usize, }