Need help to improve editor performance

I’m working with a TapTap-based editor that includes several custom node types (tables, images, LaTeX equations, etc.). The document can be quite large—around 200k words. I’ve implemented a search-and-replace module, but it becomes slow for large searches, especially when decorations need to be applied.

Are there recommended techniques for improving performance and preventing UI freezes in this scenario? Also, are there any general techniques for improving overall editor performance when working with large document with collaboration?

200k words is going to amount to a lot of DOM to keep in a browser tab. Each book within The Lord of the Rings amounts to about 150k words.

I would say you need a way to split your document into chapters/sections, and only deal with each one at a time. This could perhaps be done virtually (ie without the user knowing their “document” is really several documents).

Replacing text across a large swath is going to take time, no two ways about it, so the key is perceived performance.

Sorry this a bit of a terse answer, but the details depend on your app and PM implementation.