diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-05-25 13:44:52 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-05-26 15:05:14 +0200 |
commit | 06d39b8663fd98a82cec4015eee3b425f92bc51d (patch) | |
tree | acdbc04992d5264994ad9208cc97fdfeb95a6fac /sw/source/core/doc/docbm.cxx | |
parent | c74f633467e1cd272b8d0c285389bd855f3217a0 (diff) |
tdf#125372 writer, file with lots of hints very slow to open, part2
Reduce unnecessary scanning on MarkManager::deleteMark
Change-Id: I4af07877a98b12f20f486974eb77ee2989a2fbc9
Reviewed-on: https://gerrit.libreoffice.org/72949
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/core/doc/docbm.cxx')
-rw-r--r-- | sw/source/core/doc/docbm.cxx | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index ac20908aff32..6b28d7a54e7e 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -1018,20 +1018,19 @@ namespace sw { namespace mark " - Mark is not in my doc."); // finds the last Mark that is starting before pMark // (pMarkLow < pMark) - iterator_t pMarkLow = - lower_bound( + auto it = lower_bound( m_vAllMarks.begin(), m_vAllMarks.end(), pMark->GetMarkStart(), sw::mark::CompareIMarkStartsBefore()); - iterator_t pMarkHigh = m_vAllMarks.end(); - iterator_t pMarkFound = - find_if( - pMarkLow, - pMarkHigh, - [pMark] (pMark_t const& rpMark) { return rpMark.get() == pMark; } ); - if(pMarkFound != pMarkHigh) - deleteMark(pMarkFound); + for ( ; it != m_vAllMarks.end(); ++it) + if (pMark->StartsBefore((*it)->GetMarkStart())) + break; + else if (it->get() == pMark) + { + deleteMark(it); + break; + } } void MarkManager::clearAllMarks() |