Closed josephg closed 3 years ago
Thanks @josephg for this nice clear test case. On my laptop the performance disparity between 0.14.1 and 1.0.1-preview1 is a factor of 24, somewhat lower than the factor of 250 you report. Still bad of course, but I'm wondering where that extra factor of 10 came from. Was that a typo?
I will also note that this performance regression probably won't show up in real apps, since it only affects the function Automerge.merge()
, which is intended primarily for testing purposes (since this function can only be used if you are simulating two nodes in the same process; actual communication via a network would not use this function). However, Automerge.merge()
is useful in benchmarks, and a benchmark is not very useful if it's dominated by this function, so it does seem reasonable to make it faster.
I have put up PR #368, which brings performance back fairly close to where it was in 0.14. Could you give it a try and see how much it improves things on your machine?
Still bad of course, but I'm wondering where that extra factor of 10 came from. Was that a typo?
Not a typo. It looks like webpack is partially to blame. Replied in more detail in #368.
Sorry the example is a bit long, but this is a simple fuzzer which inserts a bunch of items randomly into 3 simulated peers, and syncs them. In automerge 0.14 on npm this runs reasonably quickly (10000 edits in 5 seconds). Using automerge 1.0.1-preview it runs much more slowly (40 iterations in 5 seconds)
The time is spent in the merge() function - you can see the inflation of merge time as the document grows:
The majority of the time (96%) is spent in
decodeColumns
Code: