2022-12-12 05:44:49 +00:00
|
|
|
use std::time::Instant;
|
|
|
|
// #[global_allocator]
|
|
|
|
// static ALLOC: dhat::Alloc = dhat::Alloc;
|
|
|
|
|
2023-07-31 03:49:55 +00:00
|
|
|
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();
|
2023-07-31 03:49:55 +00:00
|
|
|
let actor = LoroDoc::default();
|
2022-12-12 05:44:49 +00:00
|
|
|
let mut output = Vec::new();
|
2023-07-31 03:49:55 +00:00
|
|
|
let list = actor.get_list("list");
|
2023-08-04 02:45:23 +00:00
|
|
|
let mut last_vv = actor.oplog_vv();
|
2022-12-12 05:44:49 +00:00
|
|
|
for i in 0..10000 {
|
2023-07-31 03:49:55 +00:00
|
|
|
let mut txn = actor.txn().unwrap();
|
|
|
|
list.insert(&mut txn, i, i.to_string().into()).unwrap();
|
|
|
|
output.push(actor.export_from(&last_vv.clone()));
|
2023-08-04 02:45:23 +00:00
|
|
|
last_vv = actor.oplog_vv();
|
2022-12-12 05:44:49 +00:00
|
|
|
}
|
|
|
|
println!("{} ms", start.elapsed().as_millis());
|
|
|
|
// drop(p)
|
|
|
|
}
|