<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:andreas.heinisch@yahoo.de" title="Andreas Heinisch <andreas.heinisch@yahoo.de>"> <span class="fn">Andreas Heinisch</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - "Find & Replace" and "Search Results" dialog become unresponsive if there are too many hits"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=123461">bug 123461</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>andreas.heinisch@yahoo.de
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - "Find & Replace" and "Search Results" dialog become unresponsive if there are too many hits"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=123461#c6">Comment # 6</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - "Find & Replace" and "Search Results" dialog become unresponsive if there are too many hits"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=123461">bug 123461</a>
              from <span class="vcard"><a class="email" href="mailto:andreas.heinisch@yahoo.de" title="Andreas Heinisch <andreas.heinisch@yahoo.de>"> <span class="fn">Andreas Heinisch</span></a>
</span></b>
        <pre>Imho, in both cases (<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Calc doesn't answer for several minutes when searching and replacing"
   href="show_bug.cgi?id=96290">Bug 96290</a> and <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - "Find & Replace" and "Search Results" dialog become unresponsive if there are too many hits"
   href="show_bug.cgi?id=123461">Bug 123461</a>) 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 :(</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>