loro/crates/loro-internal/examples/list.rs

22 lines
645 B
Rust
Raw Normal View History

2022-12-12 05:44:49 +00:00
use std::time::Instant;
// #[global_allocator]
// static ALLOC: dhat::Alloc = dhat::Alloc;
use loro_internal::LoroCore;
2022-12-12 05:44:49 +00:00
fn main() {
// let p = dhat::Profiler::builder().trim_backtraces(None).build();
let start = Instant::now();
let mut actor = LoroCore::default();
let mut output = Vec::new();
let mut list = actor.get_list("list");
let mut last_vv = actor.vv_cloned();
2022-12-12 05:44:49 +00:00
for i in 0..10000 {
list.insert(&actor, i, i.to_string()).unwrap();
output.push(actor.encode_from(last_vv.clone()));
last_vv = actor.vv_cloned();
2022-12-12 05:44:49 +00:00
}
println!("{} ms", start.elapsed().as_millis());
// drop(p)
}