Question about Y.mergeUpdates

Which of the following has a better performance? (or does it matter?)

const update = Y.mergeUpdates(updates)
Y.applyUpdate(doc, update)

// OR
doc.transact(() => { => {
    Y.applyUpdate(doc, u)

I’ve gotten different results using different strategies depending on the number of updates, the size, and the contents(seemingly). The time difference between using different strategies is sometimes significant(order of magnitude and beyond, depending).

Sometimes merging updates is faster than creating a Y.Doc, sometimes applying individually through the Y.Doc is much faster.

Currently I batch merge in chunks of 100-500 when dealing with lots of updates and am not instantiating a Y.Doc… Will probably need to test for your use case.