sw/source/core/doc/docbm.cxx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
New commits: commit a65918c5b6aaff0206c461e46b798efb95dc42c6 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue May 28 22:10:38 2019 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed May 29 07:51:38 2019 +0200 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.gran...@collabora.co.uk> 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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits