Is the Transaction.replaceWith method efficient?

I now have a scenario that listens for changes in user input and serializes them in the editorView, and then I replace them in full with the replaceWith method. Is the repaceWith method efficient and does the internal state do diff comparisons? Or do I need to implement a diff algorithm on the outside myself for minimal updates.

Benchmark what you’re trying to do, and see if it’s fast enough for your purpose. A generic ‘is it efficient’ question is too vague to get you a useful answer.

There’s no diff algorithm in the library. There’s primitives for finding the last and first point where a pair of documents differ, but those won’t give you a full diff in case there are multiple separate changes.

thanks!!