Kaydet (Commit) a65918c5 authored tarafından Noel Grandin's avatar Noel Grandin

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: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 51fd9936
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment