mirror of
https://github.com/loro-dev/loro.git
synced 2025-01-23 21:43:59 +00:00
27 lines
687 B
Rust
27 lines
687 B
Rust
|
|
||
|
|
||
|
use bench_utils::TextAction;
|
||
|
|
||
|
use loro_internal::LoroDoc;
|
||
|
|
||
|
fn main() {
|
||
|
let actions = bench_utils::get_automerge_actions();
|
||
|
let start = std::time::Instant::now();
|
||
|
for _ in 0..10 {
|
||
|
let loro = LoroDoc::default();
|
||
|
let text = loro.get_text("text");
|
||
|
// loro.subscribe_deep(Arc::new(move |event| {
|
||
|
// black_box(event);
|
||
|
// }));
|
||
|
for TextAction { pos, ins, del } in actions.iter() {
|
||
|
let mut txn = loro.txn().unwrap();
|
||
|
text.delete(&mut txn, *pos, *del).unwrap();
|
||
|
text.insert(&mut txn, *pos, ins).unwrap();
|
||
|
}
|
||
|
|
||
|
text.diagnose();
|
||
|
}
|
||
|
|
||
|
println!("time: {:?}", start.elapsed());
|
||
|
}
|