This enhancement is based on https://bugs.documentfoundation.org/show_bug.cgi?id=119286#c14 (1) We repeatedly revalidate the paragraph signature. Since we're making changes to individual words/letters, this is effectively O(n^2). A smarter thing to do would be to only do this validation after the replace operation. (2) We create a ton of small UNDO objects. Again, a smarter thing to do would be to create a single UNDO operation. The first one is tricky because it uses the UNO API to inspect the document, while the rest of the code is using the internal raw API. The second one is tricky because there are loops at multiple levels of the call stack, and it's not clear how the responsibilities are shared across the different calls.
*** This bug has been marked as a duplicate of bug 136598 ***