diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2019-04-02 00:16:41 +0200 |
---|---|---|
committer | Xisco Faulí <xiscofauli@libreoffice.org> | 2019-04-02 13:23:36 +0200 |
commit | 3b518953a8141b0d5043c2f3996a92956fdc3a47 (patch) | |
tree | 00d9865aef3a0ab30052fbef3644dc0720607f5c /sw | |
parent | e651a4f45b310f9890ffbf712b9970d4c452ecec (diff) |
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@collabora.co.uk>
Tested-by: Jenkins
Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/docnew.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/unocore/unoportenum.cxx | 5 |
2 files changed, 4 insertions, 6 deletions
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); } } |