From dd2c2701c46c04b5cedab877c3a7835d39496ef7 Mon Sep 17 00:00:00 2001 From: Zixuan Chen Date: Tue, 1 Nov 2022 23:07:30 +0800 Subject: [PATCH] chore: more debug info --- crates/loro-core/justfile | 4 ++-- crates/loro-core/src/log_store.rs | 11 +++++++++-- crates/rle/src/rle_tree.rs | 5 +++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/crates/loro-core/justfile b/crates/loro-core/justfile index 0bb9d3d1..a8de5b87 100644 --- a/crates/loro-core/justfile +++ b/crates/loro-core/justfile @@ -17,8 +17,8 @@ deny: crev: cargo crev crate check -fuzz-yata-long: - cargo fuzz run yata -- -max_total_time=300 -max_len=4000 -jobs=2 +fuzz-long TARGET: + cargo fuzz run {{TARGET}} -- -max_total_time=300 -max_len=4000 -jobs=2 quick-fuzz: cargo fuzz run yata -- -max_total_time=10 -max_len=1000 & diff --git a/crates/loro-core/src/log_store.rs b/crates/loro-core/src/log_store.rs index 59f41e96..609196de 100644 --- a/crates/loro-core/src/log_store.rs +++ b/crates/loro-core/src/log_store.rs @@ -2,11 +2,14 @@ //! //! mod iter; -use std::marker::PhantomPinned; +use std::{marker::PhantomPinned, ops::Range}; use fxhash::{FxHashMap, FxHashSet}; -use rle::{HasLength, RleVec, RleVecWithIndex, Sliceable}; +use rle::{ + rle_tree::{node::Node, tree_trait::CumulateTreeTrait}, + HasLength, RleVec, RleVecWithIndex, Sliceable, +}; use smallvec::SmallVec; @@ -468,4 +471,8 @@ fn size_of() { println!("IdSpan {}", std::mem::size_of::()); println!("ContainerID {}", std::mem::size_of::()); println!("InternalString {}", std::mem::size_of::()); + println!( + "Node, Cumulated> {}", + std::mem::size_of::, CumulateTreeTrait, 8>>>() + ); } diff --git a/crates/rle/src/rle_tree.rs b/crates/rle/src/rle_tree.rs index c327ba4c..dd113a63 100644 --- a/crates/rle/src/rle_tree.rs +++ b/crates/rle/src/rle_tree.rs @@ -387,11 +387,12 @@ impl> RleTree { pub fn debug_inspect(&mut self) { println!( - "RleTree: \n- len={:?}\n- InternalNodes={}\n- LeafNodes={}\n- Elements={}", + "RleTree: \n- len={:?}\n- InternalNodes={}\n- LeafNodes={}\n- Elements={}\n- Bytes={}", self.len(), self.internal_node_num(), self.leaf_node_num(), - self.elem_num() + self.elem_num(), + self.with_bump(|bump| bump.allocated_bytes()) ); }