| 1 | use bench_utils::TextAction; |
| 2 | |
| 3 | use loro_internal::{cursor::PosType, LoroDoc}; |
| 4 | |
| 5 | fn 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 | |
| 12 | |
| 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 | } |