loro/crates/loro-internal/examples/automerge_x100.rs

20 lines
612 B
Rust
Raw Normal View History

2022-12-02 06:39:51 +00:00
fn main() {
2022-12-27 06:18:46 +00:00
use bench_utils::TextAction;
use loro_internal::LoroCore;
2022-12-27 06:18:46 +00:00
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();
2022-12-02 06:39:51 +00:00
let mut loro = LoroCore::default();
let start = Instant::now();
// loro.subscribe_deep(Box::new(|_| ()));
let mut text = loro.get_text("text");
for _ in 0..1 {
2022-12-27 06:18:46 +00:00
for TextAction { del, ins, pos } in actions.iter() {
text.delete_utf16(&loro, *pos, *del).unwrap();
text.insert_utf16(&loro, *pos, ins).unwrap();
2022-12-02 06:39:51 +00:00
}
}
// loro.diagnose();
println!("{}", start.elapsed().as_millis());
2022-12-02 06:39:51 +00:00
}