Bug 123461 - "Find & Replace" and "Search Results" dialog become unresponsive if there are too many hits
Summary: "Find & Replace" and "Search Results" dialog become unresponsive if there are...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
(earliest affected) release
Hardware: All Windows (All)
: high major
Assignee: Not Assigned
Depends on:
Blocks: Find&Replace-Dialog
  Show dependency treegraph
Reported: 2019-02-14 09:40 UTC by amable
Modified: 2023-08-29 03:18 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:

for work with them (356.66 KB, application/vnd.oasis.opendocument.spreadsheet)
2019-02-14 10:28 UTC, amable

Note You need to log in before you can comment on or make changes to this bug.
Description amable 2019-02-14 09:40:03 UTC
I have libreoffice and work with windows 10. 
The problem is in calc. When i want find a word and press "remplace All", the progran stop and dont work...

Steps to Reproduce:
1.open the calc document (the document have more than 12.000 wors)
2.press control + f
3.find: "anyword" and press on remplace button....
4.the program stop and dont work..

Actual Results:
the probram stop

Expected Results:
the  software muss remplace all cells with the new "word".

Reproducible: Always

User Profile Reset: No

Additional Info:
Comment 1 Timur 2019-02-14 10:08:46 UTC
Please attach a sample document, without personal data.
Comment 2 amable 2019-02-14 10:28:54 UTC
Created attachment 149292 [details]
for work with them

i want change --- and put 0. with libreoffice 6.1.4 it work.
Comment 3 Timur 2019-02-14 14:00:26 UTC
I assume steps from Description are not adequate and that steps are:
1.open ODS attachment 149292 [details]
2.Find and replace OR press control + H
3.find: "---" and press "Replace All"

I do not reproduce simple "the program stop and dont work". Replace is done. 
But I see "not responding" with "Search Results" window. Hard to press Close. 
Not memory issue. So I set to New, unless explained differently. 
Test LO 6.2 and 6.3+ in Windows. I also reproduce before.
This may well be a duplicate of bug 104849 or bug 87965. As explained there, it's not replace that's slow but Search Window.
Comment 4 Oliver Brinzing 2019-02-14 18:19:32 UTC
(In reply to Timur from comment #3)
> I do not reproduce simple "the program stop and dont work". Replace is done. 
> But I see "not responding" with "Search Results" window. Hard to press
> Close. 

i can confirm the problem with:

Version: (x64)
Build ID: 90f8dcf33c87b3705e78202e3df5142b201bd805
CPU threads: 4; OS: Windows 10.0; UI render: default; 
Locale: de-DE (de_DE); Calc: 

Find & Replace dialog and "Search Result" dialog become unresponsive.
Comment 5 Timur 2019-11-25 09:09:47 UTC
Behavior is for me different to bug 96290. There, Search Results (with 3100 hits) is quick. Here, Search Results is *very* slow to show (and my CPU is above 50%). 
If I disable it in expert configuration, better, although there's again some sluggishness (that's like in bug 96290).
Comment 6 Andreas Heinisch 2021-08-28 15:23:08 UTC
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 :(
Comment 7 QA Administrators 2023-08-29 03:18:21 UTC
Dear amable,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)

If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword

Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team