[Libreoffice-commits] core.git: sw/source
Xisco Fauli (via logerrit)
logerrit at kemper.freedesktop.org
Tue Apr 2 11:23:59 UTC 2019
sw/source/core/doc/docnew.cxx | 5 ++---
sw/source/core/unocore/unoportenum.cxx | 5 ++---
2 files changed, 4 insertions(+), 6 deletions(-)
New commits:
commit 3b518953a8141b0d5043c2f3996a92956fdc3a47
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Tue Apr 2 00:16:41 2019 +0200
Commit: Xisco FaulĂ <xiscofauli at libreoffice.org>
CommitDate: Tue Apr 2 13:23:36 2019 +0200
tdf#122926: Use o3tl::sorted_vector in other similar places
it doesn't give any win to the attached document,
but seeing we get a 2 secs win with
9634f5ee73e57e8cef75461316d5d45b06ee104f, we can use
the same logic in two similar places hoping other
documents will get benefited
Change-Id: Ie1e76a4317d5b2274335479037b248fe7b1e2a61
Reviewed-on: https://gerrit.libreoffice.org/70092
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
Tested-by: Jenkins
Reviewed-by: Xisco FaulĂ <xiscofauli at libreoffice.org>
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 87f51c3ffd5b..613c0b50aa48 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -1084,16 +1084,15 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu
--aNodeIndex;
SwPaM aPaM(aNodeIndex);
// Collect the marks starting or ending at this text node.
- std::set<sw::mark::IMark*> aSeenMarks;
+ o3tl::sorted_vector<sw::mark::IMark*> aSeenMarks;
IDocumentMarkAccess* pMarkAccess = getIDocumentMarkAccess();
for (const SwIndex* pIndex = pTextNode->GetFirstIndex(); pIndex; pIndex = pIndex->GetNext())
{
sw::mark::IMark* pMark = const_cast<sw::mark::IMark*>(pIndex->GetMark());
if (!pMark)
continue;
- if (aSeenMarks.find(pMark) != aSeenMarks.end())
+ if (!aSeenMarks.insert(pMark).second)
continue;
- aSeenMarks.insert(pMark);
}
// And move them back.
for (sw::mark::IMark* pMark : aSeenMarks)
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index a370fe2dabc6..9a7605644b5d 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -203,7 +203,7 @@ namespace
else
{
// A text node already knows its marks via its SwIndexes.
- std::set<sw::mark::IMark*> aSeenMarks;
+ o3tl::sorted_vector<const sw::mark::IMark*> aSeenMarks;
for (const SwIndex* pIndex = pTextNode->GetFirstIndex(); pIndex; pIndex = pIndex->GetNext())
{
// Need a non-cost mark here, as we'll create an UNO wrapper around it.
@@ -216,9 +216,8 @@ namespace
eType != IDocumentMarkAccess::MarkType::CROSSREF_HEADING_BOOKMARK)
continue;
// Only handle bookmarks once, if they start and end at this node as well.
- if (aSeenMarks.find(pBkmk) != aSeenMarks.end())
+ if (!aSeenMarks.insert(pBkmk).second)
continue;
- aSeenMarks.insert(pBkmk);
lcl_FillBookmark(pBkmk, nOwnNode, rDoc, rBkmArr);
}
}
More information about the Libreoffice-commits
mailing list