summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2024-05-31 15:04:27 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-06-01 12:55:53 +0200
commit1291edd7ed369ee97177cab2910f2396302ebacf (patch)
tree099bb7dccd033d11c6e7b13832386614d8176dcc /sw/source
parenta3f537e13ee64c5bf3155864035c1591e7099101 (diff)
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/doc/DocumentRedlineManager.cxx6
1 files changed, 3 insertions, 3 deletions
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;