sw/source/core/doc/DocumentRedlineManager.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 1291edd7ed369ee97177cab2910f2396302ebacf
Author:     Noel Grandin <[email protected]>
AuthorDate: Fri May 31 15:04:27 2024 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Sat Jun 1 12:55:53 2024 +0200

    tdf#144208 speedup doc with lots of redline(2)
    
    use iterators to avoid indexing and cost of repeatedly calling size(),
    shaves 1-2% off load time
    
    Change-Id: Id6e39beabeb47cae479154e0636e504b7f7ba2fa
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168306
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx 
b/sw/source/core/doc/DocumentRedlineManager.cxx
index 6e287c6fb91f..9ae003980701 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -2823,9 +2823,9 @@ SwRedlineTable::size_type 
DocumentRedlineManager::GetRedlinePos( const SwNode& r
     }
     else
     {
-        for( SwRedlineTable::size_type n = 0; n < maRedlineTable.size() ; ++n )
+        for( auto it = maRedlineTable.begin(), itEnd = maRedlineTable.end(); 
it != itEnd; ++it )
         {
-            const SwRangeRedline* pTmp = maRedlineTable[ n ];
+            const SwRangeRedline* pTmp = *it;
             SwNodeOffset nPt = pTmp->GetPoint()->GetNodeIndex(),
                   nMk = pTmp->GetMark()->GetNodeIndex();
             if( nPt < nMk )
@@ -2833,7 +2833,7 @@ SwRedlineTable::size_type 
DocumentRedlineManager::GetRedlinePos( const SwNode& r
 
             if( ( RedlineType::Any == nType || nType == pTmp->GetType()) &&
                 nMk <= nNdIdx && nNdIdx <= nPt )
-                return n;
+                return std::distance(maRedlineTable.begin(), it);
 
             if( nMk > nNdIdx )
                 break;

Reply via email to