2023-08-28 08:16:40 +00:00
|
|
|
use bench_utils::TextAction;
|
|
|
|
use loro_internal::LoroDoc;
|
2022-11-14 10:42:16 +00:00
|
|
|
|
|
|
|
fn main() {
|
2023-08-28 08:16:40 +00:00
|
|
|
let actions = bench_utils::get_automerge_actions();
|
|
|
|
let loro = LoroDoc::default();
|
|
|
|
let text = loro.get_text("text");
|
|
|
|
let mut txn = loro.txn().unwrap();
|
|
|
|
|
|
|
|
for TextAction { pos, ins, del } in actions.iter() {
|
|
|
|
text.delete(&mut txn, *pos, *del).unwrap();
|
|
|
|
text.insert(&mut txn, *pos, ins).unwrap();
|
|
|
|
}
|
|
|
|
|
|
|
|
txn.commit().unwrap();
|
|
|
|
for _ in 0..10 {
|
|
|
|
loro.export_from(&Default::default());
|
|
|
|
}
|
|
|
|
let data = loro.export_from(&Default::default());
|
|
|
|
for _ in 0..100 {
|
|
|
|
let mut b = LoroDoc::default();
|
|
|
|
b.detach();
|
|
|
|
b.import(&data).unwrap();
|
|
|
|
}
|
2022-11-14 10:42:16 +00:00
|
|
|
}
|