2023-10-29 06:02:13 +00:00
|
|
|
use loro_common::ID;
|
|
|
|
use loro_internal::{version::Frontiers, LoroDoc};
|
2023-07-31 03:49:55 +00:00
|
|
|
|
2022-12-02 06:39:51 +00:00
|
|
|
fn main() {
|
2022-12-27 06:18:46 +00:00
|
|
|
use bench_utils::TextAction;
|
|
|
|
use std::time::Instant;
|
2022-12-02 06:39:51 +00:00
|
|
|
|
2022-12-27 06:18:46 +00:00
|
|
|
let actions = bench_utils::get_automerge_actions();
|
2023-12-03 06:54:45 +00:00
|
|
|
let loro = LoroDoc::default();
|
2022-12-06 08:34:46 +00:00
|
|
|
let start = Instant::now();
|
2023-04-03 01:29:25 +00:00
|
|
|
// loro.subscribe_deep(Box::new(|_| ()));
|
2023-07-31 03:49:55 +00:00
|
|
|
let text = loro.get_text("text");
|
2023-04-03 01:29:25 +00:00
|
|
|
for _ in 0..1 {
|
2023-10-29 06:02:13 +00:00
|
|
|
let mut txn = loro.txn().unwrap();
|
2022-12-27 06:18:46 +00:00
|
|
|
for TextAction { del, ins, pos } in actions.iter() {
|
2023-11-28 08:22:43 +00:00
|
|
|
text.delete_with_txn(&mut txn, *pos, *del).unwrap();
|
|
|
|
text.insert_with_txn(&mut txn, *pos, ins).unwrap();
|
2022-12-02 06:39:51 +00:00
|
|
|
}
|
|
|
|
}
|
2023-10-29 06:02:13 +00:00
|
|
|
loro.checkout(&Frontiers::from(ID::new(loro.peer_id(), 100)))
|
|
|
|
.unwrap();
|
2023-04-03 01:29:25 +00:00
|
|
|
// loro.diagnose();
|
2022-12-06 08:34:46 +00:00
|
|
|
println!("{}", start.elapsed().as_millis());
|
2022-12-02 06:39:51 +00:00
|
|
|
}
|