Since all you do is add some text to the page, you can probably speed up the process by simply editing the content flows of the pages directly. The merger is associated with fonts, other resources, clipping boxes, etc., which significantly slows down the process. If you really need to change some of these things, the solution becomes more complex. Code example:
TEXT_STREAM = []
source share