From 29a7623c3f4cfed9e3b7e0cefa4bf74c4fdb2b0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Wed, 25 Sep 2024 15:57:50 +0200 Subject: [PATCH] Fxi some logs --- milli/src/update/new/extract/cache.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/milli/src/update/new/extract/cache.rs b/milli/src/update/new/extract/cache.rs index 1c7db0473..1e95d9cda 100644 --- a/milli/src/update/new/extract/cache.rs +++ b/milli/src/update/new/extract/cache.rs @@ -9,9 +9,11 @@ use super::lru::Lru; use crate::update::del_add::{DelAdd, KvWriterDelAdd}; use crate::CboRoaringBitmapCodec; +const KEY_SIZE: usize = 8; + #[derive(Debug)] pub struct CboCachedSorter { - cache: Lru, DelAddRoaringBitmap>, + cache: Lru, DelAddRoaringBitmap>, sorter: Sorter, deladd_buffer: Vec, cbo_buffer: Vec, @@ -40,7 +42,7 @@ impl CboCachedSorter { } None => { self.total_insertions += 1; - self.fitted_in_key += (key.len() <= 20) as usize; + self.fitted_in_key += (key.len() <= KEY_SIZE) as usize; let value = DelAddRoaringBitmap::new_del_u32(n); if let Some((key, deladd)) = self.cache.push(key.into(), value) { self.write_entry(key, deladd)?; @@ -62,7 +64,7 @@ impl CboCachedSorter { } None => { self.total_insertions += 1; - self.fitted_in_key += (key.len() <= 20) as usize; + self.fitted_in_key += (key.len() <= KEY_SIZE) as usize; let value = DelAddRoaringBitmap::new_del(bitmap); if let Some((key, deladd)) = self.cache.push(key.into(), value) { self.write_entry(key, deladd)?; @@ -80,7 +82,7 @@ impl CboCachedSorter { } None => { self.total_insertions += 1; - self.fitted_in_key += (key.len() <= 20) as usize; + self.fitted_in_key += (key.len() <= KEY_SIZE) as usize; let value = DelAddRoaringBitmap::new_add_u32(n); if let Some((key, deladd)) = self.cache.push(key.into(), value) { self.write_entry(key, deladd)?; @@ -102,7 +104,7 @@ impl CboCachedSorter { } None => { self.total_insertions += 1; - self.fitted_in_key += (key.len() <= 20) as usize; + self.fitted_in_key += (key.len() <= KEY_SIZE) as usize; let value = DelAddRoaringBitmap::new_add(bitmap); if let Some((key, deladd)) = self.cache.push(key.into(), value) { self.write_entry(key, deladd)?; @@ -121,7 +123,7 @@ impl CboCachedSorter { } None => { self.total_insertions += 1; - self.fitted_in_key += (key.len() <= 20) as usize; + self.fitted_in_key += (key.len() <= KEY_SIZE) as usize; let value = DelAddRoaringBitmap::new_del_add_u32(n); if let Some((key, deladd)) = self.cache.push(key.into(), value) { self.write_entry(key, deladd)?; @@ -177,7 +179,7 @@ impl CboCachedSorter { } eprintln!( - "LruCache stats: {} <= 20 bytes ({}%) on a total of {} insertions", + "LruCache stats: {} <= {KEY_SIZE} bytes ({}%) on a total of {} insertions", self.fitted_in_key, (self.fitted_in_key as f32 / self.total_insertions as f32) * 100.0, self.total_insertions,