chore: cleanup

This commit is contained in:
Zixuan Chen 2024-08-10 17:38:24 +08:00
parent 0bac73b029
commit e00337d7d8
No known key found for this signature in database
3 changed files with 2 additions and 6 deletions

View file

@ -55,11 +55,6 @@ pub fn main() {
after_free_history_cache - after_compact_change_store 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(); let snapshot = doc.export_snapshot();
println!("Snapshot size: {}", ByteSize(snapshot.len())); println!("Snapshot size: {}", ByteSize(snapshot.len()));
} }

View file

@ -206,6 +206,7 @@ mod mem {
end: Bound<&[u8]>, end: Bound<&[u8]>,
f: CompareFn, f: CompareFn,
) -> Option<(Bytes, Bytes)> { ) -> Option<(Bytes, Bytes)> {
// PERF: This is super slow
for (k, v) in self.range::<[u8], _>((start, end)) { for (k, v) in self.range::<[u8], _>((start, end)) {
match f(k, v) { match f(k, v) {
std::cmp::Ordering::Equal => return Some((k.clone(), v.clone())), std::cmp::Ordering::Equal => return Some((k.clone(), v.clone())),

View file

@ -1157,7 +1157,7 @@ impl LoroDoc {
/// ///
/// Panic when it's not consistent /// Panic when it's not consistent
pub fn check_state_diff_calc_consistency_slow(&self) { 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); static IS_CHECKING: AtomicBool = AtomicBool::new(false);
if IS_CHECKING.load(std::sync::atomic::Ordering::Acquire) { if IS_CHECKING.load(std::sync::atomic::Ordering::Acquire) {