How to efficiently replace specific text in a large number of texts

there is a scenario where some text in a text with 20w characters needs to be regularly matched and replaced.

but for cards that are special in this process, using chrome browsers under mac will get stuck for nearly 20s. If you perform such a task several times, it will naturally take a lot of time.

is there a faster way to do this?

Mar.16,2021

regular global replacement is too slow. You can only change the strategy. For example, if you don't have to replace it all at once, you can replace that part separately when you need to use it. Or read multiple buffer when reading, and then open worker multithreaded replacement. You can drop a progress bar to let the user know that you are dealing with


20w characters that do not need to be displayed at once and processed in segments. Just make sure that the initial render load of the page meets the visual range.

Menu