I’ve recently implemented CodeMirror Merge as an Angular component in a project and I’m finding it freezes the whole window while loading very large (182k line JSON), completely different files.
It’s possibly related to:
In our case, the old behaviour in CodeMirror 5 finishes in a few seconds compared to the new CodeMirror Merge usage under version 6 which can take 20+ minutes for the same diff.
I know this is an extreme scenario as it’s not everyday people need to be able to do this, but for our usage it’s entirely possible that the JSON datasets being compared are completely different which makes it impractical for our usage.
Is there anything we can do to optimise this or bail out of the diff after x seconds? I can see the same behaviour occurs when testing with the merge example at: https://marijnhaverbeke.nl/upload/merge/
I was able to generate large test data to simulate the issue:
Seems at some document size, even the fast path is still too slow. Attached patch adds an even faster path (just treat the entire range as unchanged) for situations like this.