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

24 lines
709 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::LoroDoc;
2022-12-12 05:44:49 +00:00
fn main() {
// let p = dhat::Profiler::builder().trim_backtraces(None).build();
let start = Instant::now();
let actor = LoroDoc::default();
2022-12-12 05:44:49 +00:00
let mut output = Vec::new();
let list = actor.get_list("list");
let mut last_vv = actor.oplog_vv();
2022-12-12 05:44:49 +00:00
for i in 0..10000 {
let mut txn = actor.txn().unwrap();
2023-11-28 08:22:43 +00:00
list.insert_with_txn(&mut txn, i, i.to_string().into())
.unwrap();
output.push(actor.export_from(&last_vv.clone()));
last_vv = actor.oplog_vv();
2022-12-12 05:44:49 +00:00
}
println!("{} ms", start.elapsed().as_millis());
// drop(p)
}