[Libreoffice-bugs] [Bug 123461] "Find & Replace" and "Search Results" dialog become unresponsive if there are too many hits

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Sat Aug 28 15:23:08 UTC 2021


https://bugs.documentfoundation.org/show_bug.cgi?id=123461

Andreas Heinisch <andreas.heinisch at yahoo.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andreas.heinisch at yahoo.de

--- Comment #6 from Andreas Heinisch <andreas.heinisch at yahoo.de> ---
Imho, in both cases (Bug 96290 and Bug 123461) the culprit is ScRangeList::Join
which tries to join the marked ranges. It holds a list of ranges and checks if
it can join with the found one, otherwise it adds the new created ranges and
continues to join the remaining ranges from the search result.

The internal data structure is a vector and the data is as follows:
[0] = {aStart={nRow=1 nCol=1 nTab=0 } aEnd={nRow=2 nCol=1 nTab=0 } }
[1] = {aStart={nRow=4 nCol=1 nTab=0 } aEnd={nRow=6 nCol=1 nTab=0 } }
[2] = {aStart={nRow=9 nCol=1 nTab=0 } aEnd={nRow=15 nCol=1 nTab=0 } }
[3] = {aStart={nRow=18 nCol=1 nTab=0 } aEnd={nRow=20 nCol=1 nTab=0 } }
[4] = {aStart={nRow=22 nCol=1 nTab=0 } aEnd={nRow=24 nCol=1 nTab=0 } }
[5] = {aStart={nRow=26 nCol=1 nTab=0 } aEnd={nRow=26 nCol=1 nTab=0 } }
[6] = {aStart={nRow=28 nCol=1 nTab=0 } aEnd={nRow=29 nCol=1 nTab=0 } }
[7] = {aStart={nRow=32 nCol=1 nTab=0 } aEnd={nRow=35 nCol=1 nTab=0 } }
[8] = {aStart={nRow=37 nCol=1 nTab=0 } aEnd={nRow=37 nCol=1 nTab=0 } }
[9] = {aStart={nRow=40 nCol=1 nTab=0 } aEnd={nRow=42 nCol=1 nTab=0 } }
[10] = {aStart={nRow=44 nCol=1 nTab=0 } aEnd={nRow=55 nCol=1 nTab=0 } }

The algorithm always loops over all ranges to check whether a range can be
joined or not. A new range may look like the following:
rNewRange = {aStart={nRow=66 nCol=14 nTab=0 } aEnd={nRow=67 nCol=14 nTab=0 } }

In the end it gets even worse, because if a range can be joined, the function
tries to join the newly created range as well. In this case, the range contains
about 6974 ranges which leads to this performance issue.

Imho, a vector of ranges maybe the wrong data structure when there a fast
access is needed.

So either we show only around a 1000 marked ranges, or we have to think about a
better algorithm which can join ranges faster :(

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20210828/a5bd2470/attachment.htm>


More information about the Libreoffice-bugs mailing list