diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-06-26 15:19:36 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-06-28 12:47:35 +0200 |
commit | 47e04cf31c6165dd55dc20962ad9c72962b958bd (patch) | |
tree | c8c996c05d9fd8e2f611d5accc280678bcabd0de /sw/source/core/edit/edfcol.cxx | |
parent | b399dba597c90777c0edf2c5b19d029b3bff23df (diff) |
tdf#125706 and tdf#125665 writer, speed up RDF
The RDF stuff is sloooooooow, so (a) add some caching and (b) fold a
very hot UNO_QUERY call.
To add the caching we need to add a new UNO interface, since
XEnumeration is not amenable to being cached.
Add an optimised getStatementsGraph_NoLock2 that skips the intermediate
enumeration object, and consequently a lot of locking/unlocking.
Cache by OUString key, to avoid expensive OUString<->OString conversion
when looking up entries in the cache.
For the test document in tdf#125706, this takes the time from 7s to 5s for me.
For the test document in tdf#125665, this takes the load time
from 60s to 7s for me.
Change-Id: I207387e975b4f107834edd0974134c481fb4012d
Reviewed-on: https://gerrit.libreoffice.org/74740
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/core/edit/edfcol.cxx')
-rw-r--r-- | sw/source/core/edit/edfcol.cxx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index 4df464ee49ed..a61964900a1d 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -1157,12 +1157,14 @@ void SwEditShell::SetClassification(const OUString& rName, SfxClassificationPoli } } +// We pass xParent and xNodeSubject even though they point to the same thing because the UNO_QUERY is +// on a performance-sensitive path. static void lcl_ApplyParagraphClassification(SwDoc* pDoc, const uno::Reference<frame::XModel>& xModel, const uno::Reference<text::XTextContent>& xParent, + const css::uno::Reference<css::rdf::XResource>& xNodeSubject, std::vector<svx::ClassificationResult> aResults) { - css::uno::Reference<css::rdf::XResource> xNodeSubject(xParent, uno::UNO_QUERY); if (!xNodeSubject.is()) return; @@ -1279,7 +1281,7 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe uno::Reference<frame::XModel> xModel = pDocShell->GetBaseModel(); uno::Reference<text::XTextContent> xParent = SwXParagraph::CreateXParagraph(*pNode->GetDoc(), pNode); - lcl_ApplyParagraphClassification(GetDoc(), xModel, xParent, std::move(aResults)); + lcl_ApplyParagraphClassification(GetDoc(), xModel, xParent, css::uno::Reference<css::rdf::XResource>(xParent, uno::UNO_QUERY), std::move(aResults)); } static std::vector<svx::ClassificationResult> lcl_CollectParagraphClassification(const uno::Reference<frame::XModel>& xModel, const uno::Reference<text::XTextContent>& xParagraph) @@ -1987,7 +1989,7 @@ void SwEditShell::RestoreMetadataFieldsAndValidateParagraphSignatures() } // Update classification based on results. - lcl_ApplyParagraphClassification(GetDoc(), xModel, xParagraph, aResults); + lcl_ApplyParagraphClassification(GetDoc(), xModel, xParagraph, xSubject, aResults); // Get Signatures std::map<OUString, SignatureDescr> aSignatures; |