diff options
author | Ashod Nakashian <ashodnakashian@yahoo.com> | 2015-10-26 10:03:50 -0400 |
---|---|---|
committer | Björn Michaelsen <bjoern.michaelsen@canonical.com> | 2015-10-27 13:49:55 +0000 |
commit | f99e8f84f5421076b6c0c10a592e43843eabd8ff (patch) | |
tree | aee30001c62ece85b5e1ac40e9ab1e8f1e750696 /sw/source/core/doc/CntntIdxStore.cxx | |
parent | 973a4086d7a832398997f0c3f0705582e437f596 (diff) |
Optimised UnoCrsrTbl cleanup for faster doc saving
SwDoc has weak_ptr list to notify UnoCrsr instances
when the doc is about to die. These were updated
when each UnoCrsr instance was destroyed.
The first performance issue is the use of a list.
This no doubt is done to avoid the overhead
of removing items at arbitrary position from a
vector. Performance tests show vector is faster
with a large document and ~10k UnoCrsr instances.
More important, there is no need to clean up
the references as frequently as when each
UnoCrsr is destroyed as they are rarely referenced
at all. Having outdated references is no issue either.
The new logic uses a vector and cleans up only
after saving a document and before saving
UnoCrsr instances.
Saving ODT files is now significantly faster for
large documents (100s of pages).
Change-Id: I3895d9d80d174cda9c94b94837e2149e9fadcb42
Reviewed-on: https://gerrit.libreoffice.org/19604
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
Diffstat (limited to 'sw/source/core/doc/CntntIdxStore.cxx')
-rw-r--r-- | sw/source/core/doc/CntntIdxStore.cxx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sw/source/core/doc/CntntIdxStore.cxx b/sw/source/core/doc/CntntIdxStore.cxx index 0bcfb344757a..fa555627a368 100644 --- a/sw/source/core/doc/CntntIdxStore.cxx +++ b/sw/source/core/doc/CntntIdxStore.cxx @@ -378,7 +378,8 @@ void ContentIdxStoreImpl::RestoreFlys(SwDoc* pDoc, updater_t& rUpdater, bool bAu void ContentIdxStoreImpl::SaveUnoCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nContent) { - for (auto pWeakUnoCrsr : pDoc->mvUnoCrsrTbl) + pDoc->cleanupUnoCrsrTbl(); + for (const auto& pWeakUnoCrsr : pDoc->mvUnoCrsrTbl) { auto pUnoCrsr(pWeakUnoCrsr.lock()); if(!pUnoCrsr) |