loro/crates/loro-internal/examples/list.rs
Zixuan Chen c105ff2220
Feat: checkout to target version & use unicode index by default (#98)
* feat: checkout to frontiers

* feat: record timestamp

* fix: use unicode len by default for text
now "你好" has length of 2 instead of 6

* chore: rm dbg!
2023-08-04 10:45:23 +08:00

22 lines
687 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.oplog_vv();
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.oplog_vv();
}
println!("{} ms", start.elapsed().as_millis());
// drop(p)
}