forge
Explore
Log in

Don't you dare go Hollow

project_note

Clone
★ 0

0 watching0 forksRust3.6 MiBc49f5e7Tahinli1 month ago2 commits

obs.rs26 lines, 792 bytesHistoryRawDownload
1use bench_utils::TextAction;
2
3use loro_internal::{cursor::PosType, LoroDoc};
4
5fn main() {
6 let actions = bench_utils::get_automerge_actions();
7 let start = std::time::Instant::now();
8 for _ in 0..10 {
9 let loro = LoroDoc::default();
10 let text = loro.get_text("text");
11 // loro.subscribe_deep(Arc::new(move |event| {
12 // black_box(event);
13 // }));
14 for TextAction { pos, ins, del } in actions.iter() {
15 let mut txn = loro.txn().unwrap();
16 text.delete_with_txn(&mut txn, *pos, *del, PosType::Unicode)
17 .unwrap();
18 text.insert_with_txn(&mut txn, *pos, ins, PosType::Unicode)
19 .unwrap();
20 }
21
22 text.diagnose();
23 }
24
25 println!("time: {:?}", start.elapsed());
26}