automerge / automerge-classic

A JSON-like data structure (a CRDT) that can be modified concurrently by different users, and merged again automatically.
http://automerge.org/
MIT License
14.75k stars 466 forks source link

Long load time for a document with 1.5k changes #390

Closed skokenes closed 1 year ago

skokenes commented 3 years ago

I'm not sure what the expected performance is of the AM 1.0 branch so I wanted to share this example and get some feedback.

I have an Automerge document with 1,618 changes. When loading it from a serialized state on my machine, it takes ~9.3s for the document to be loaded. Serializing it takes about 1.2s.

Is this expected with the initial release? These changes were generated during a co-authoring session with 2 other users over the course of 45 minutes.

Here is a script you can reuse to reproduce this, with the document in question embedded in a base64 string: https://gist.github.com/skokenes/d509a5802362bc2bd8ec5cde107b35bd

pvh commented 3 years ago

I can confirm the issue -- I see a very similar load time on my machine.

orionz commented 3 years ago

I benchmarked this and had it run in 12 seconds. I tried it with the rust WASM backend and it loaded in 2.7s. I did some profiling and was able to get it down to 2.0s. In native rust it loads in 700ms. I can get it much faster but it will require deeper changes.

ept commented 2 years ago

Hi @skokenes, I've been doing some work on improving load times (#436) and with that new backend I see a 11x speedup in loading your document. It's still not as fast as I would like, but we're making progress.

ept commented 1 year ago

The Rust/Wasm implementation of Automerge is now providing good performance and we are in the process of moving the JS API to being a wrapper around the Wasm module, so I'm going to close this.