loro/crates/loro-internal/examples/list.rs
Zixuan Chen 1e736df133
Refactor: rm legacy code (#97)
* refactor: rm legacy code

* chore: rm dead code

* refactor: mv refactored files outside

* refactor: rename files & methods

* chore: rm unused deps

* fix: compact bytes err

* chore: fix ci
2023-07-31 11:49:55 +08:00

22 lines
689 B
Rust

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