summaryrefslogtreecommitdiff
path: root/sw/source/core/doc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-05-28 22:10:38 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-05-29 07:51:38 +0200
commita65918c5b6aaff0206c461e46b798efb95dc42c6 (patch)
tree9dedd65537a4c3e33e8f527e2e7fc3cb9d9296cf /sw/source/core/doc
parent51fd99367b517b9a7630f5c089d5fa22a7252472 (diff)
tdf#125372 writer, file with lots of hints very slow to open, part4
Takes load time from 4m to 3m Use equal_range to give us a start and an end, so we avoid the operator< cost while scanning Change-Id: Ie57d460237cddaacecdc6032136f614e02d13760 Reviewed-on: https://gerrit.libreoffice.org/73124 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/core/doc')
-rw-r--r--sw/source/core/doc/docbm.cxx13
1 files changed, 8 insertions, 5 deletions
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 8f0dc5b90749..283585c7aa2c 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -161,6 +161,11 @@ namespace
struct CompareIMarkStartsBefore
{
+ bool operator()(SwPosition const& rPos,
+ std::shared_ptr<sw::mark::IMark> const& pMark)
+ {
+ return rPos < pMark->GetMarkStart();
+ }
bool operator()(std::shared_ptr<sw::mark::IMark> const& pMark,
SwPosition const& rPos)
{
@@ -1039,15 +1044,13 @@ namespace sw { namespace mark
" - Mark is not in my doc.");
// finds the last Mark that is starting before pMark
// (pMarkLow < pMark)
- auto it = lower_bound(
+ auto [it, endIt] = equal_range(
m_vAllMarks.begin(),
m_vAllMarks.end(),
pMark->GetMarkStart(),
CompareIMarkStartsBefore());
- for ( ; it != m_vAllMarks.end(); ++it)
- if (pMark->GetMarkStart() < (*it)->GetMarkStart())
- break;
- else if (it->get() == pMark)
+ for ( ; it != endIt; ++it)
+ if (it->get() == pMark)
{
deleteMark(it);
break;