From e00337d7d8207e44850ab8aece38445b8f827ad4 Mon Sep 17 00:00:00 2001 From: Zixuan Chen Date: Sat, 10 Aug 2024 17:38:24 +0800 Subject: [PATCH] chore: cleanup --- crates/examples/examples/sheet.rs | 5 ----- crates/loro-internal/src/kv_store.rs | 1 + crates/loro-internal/src/loro.rs | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/crates/examples/examples/sheet.rs b/crates/examples/examples/sheet.rs index 9827875b..3c06a406 100644 --- a/crates/examples/examples/sheet.rs +++ b/crates/examples/examples/sheet.rs @@ -55,11 +55,6 @@ pub fn main() { after_free_history_cache - after_compact_change_store ); - // Checkout after compact change store - doc.check_state_correctness_slow(); - let after_checkout = get_mem_usage(); - println!("Allocated bytes after checkout: {}", after_checkout); - let snapshot = doc.export_snapshot(); println!("Snapshot size: {}", ByteSize(snapshot.len())); } diff --git a/crates/loro-internal/src/kv_store.rs b/crates/loro-internal/src/kv_store.rs index 2c44676b..6a075280 100644 --- a/crates/loro-internal/src/kv_store.rs +++ b/crates/loro-internal/src/kv_store.rs @@ -206,6 +206,7 @@ mod mem { end: Bound<&[u8]>, f: CompareFn, ) -> Option<(Bytes, Bytes)> { + // PERF: This is super slow for (k, v) in self.range::<[u8], _>((start, end)) { match f(k, v) { std::cmp::Ordering::Equal => return Some((k.clone(), v.clone())), diff --git a/crates/loro-internal/src/loro.rs b/crates/loro-internal/src/loro.rs index 4a9e8825..2646546c 100644 --- a/crates/loro-internal/src/loro.rs +++ b/crates/loro-internal/src/loro.rs @@ -1157,7 +1157,7 @@ impl LoroDoc { /// /// Panic when it's not consistent pub fn check_state_diff_calc_consistency_slow(&self) { - // #[cfg(any(test, debug_assertions))] + #[cfg(any(test, debug_assertions, feature = "test_utils"))] { static IS_CHECKING: AtomicBool = AtomicBool::new(false); if IS_CHECKING.load(std::sync::atomic::Ordering::Acquire) {