Degrading performance over time
Author: dilepingCreated Jul 8, 2024Updated Aug 28, 2026
Labelsperformance
Hi!
I was testing automerge in Rust and encountered significant performance degradation in tests with larger iteration counts. Here is a simple snippet to reproduce:
fn snippet(count: usize) -> anyhow::Result<()> {
let mut doc = AutoCommit::new();
let map = doc.put_object(automerge::ROOT, "test", ObjType::Map)?;
for i in 0..count {
doc.put(&map, "leaf", ScalarValue::Uint(i as u64))?;
}
Ok(())
}It looks like the performance is O(n^2), where n - is the size of the history.
Am I doing something wrong, or is it by design?
Source: automerge/automerge