Created attachment 200025 [details] A large number of small tables with bookmarks Attached is the following ODF markup repeated 20 000 times: <table:table> <table:table-column/> <table:table-column/> <table:table-row> <table:table-cell office:value-type="string"> <text:p><text:bookmark-start text:name="Bookmark 1"/>abc<text:bookmark-end text:name="Bookmark 1"/></text:p> </table:table-cell> <table:table-cell/> </table:table-row> <table:table-row> <table:table-cell/> <table:table-cell/> </table:table-row> </table:table> <text:p/> <text:p/> (the index of the bookmark increments each time). It takes significant time to open; and that time depends on the repeat count in a non-linear way, even when opening the document in hidden mode, e.g. using code like this: prop = new com.sun.star.beans.PropertyValue prop.Name = "Hidden" prop.Value = true 'create hidden ticks = GetSystemTicks doc = StarDesktop.loadComponentFromURL(ConvertToURL("path/to/tableWithBookmark_20000.fodt"), "_default", 0, array(prop)) ticks = GetSystemTicks - ticks MsgBox ticks doc.close(True) E.g., on my system, limiting the document to 5000 copies gives times around 1940 ticks; 10000 copies take ~2390 ticks; 20000 copies take ~5790 ticks; 40000 copies need ~17700 ticks. The part of loading procedure that creates the non-linear complexity needs optimization.
https://gerrit.libreoffice.org/c/core/+/183348
Mike Kaganski committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/f9b487f44fc8a65febafc5ea713e493369be9445 tdf#165918: Avoid bookmarks correction when removing temporary nodes It will be available in 25.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.