summaryrefslogtreecommitdiff
path: root/include/svl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-05-04 14:38:07 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-05-07 10:54:20 +0200
commitf1ed27eed68228edbab5eb63951a602263e4c3a7 (patch)
tree3e85226dbd00ed61b7c38a080fff8ef063e75140 /include/svl
parentf0c3fc59e1eefbec202e0a10553dd6581fc2cae5 (diff)
tdf#63640 FILEOPEN/FILESAVE: particular .odt loads/saves very slow, part2
Use the existing sorting functionality in SfxItemPool and extend it to search for NameOrIndex item in SvxUnoNameItemTable This is a little tricky in that we are defining only a partial ordering over the CntUnencodedStringItem (and their subclasses) items. Partial because I can only use the part of the item that is not randomly mutated by various code, which is why the other fields in the subclasses are mostly out of bounds. I had to exclude FillBitmapItem because it triggers a unit test failure and I cannot figure out why that specific item does not play nice with this optimisation. After this optimisation, the load time goes from 3.6s to 2s on my machine. Change-Id: I52d58c68db2536b69a7b0a9611a2b4c703bc4928 Reviewed-on: https://gerrit.libreoffice.org/71461 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/svl')
-rw-r--r--include/svl/custritm.hxx4
-rw-r--r--include/svl/itempool.hxx6
2 files changed, 8 insertions, 2 deletions
diff --git a/include/svl/custritm.hxx b/include/svl/custritm.hxx
index 3899df7b2fbc..5677c990569e 100644
--- a/include/svl/custritm.hxx
+++ b/include/svl/custritm.hxx
@@ -23,6 +23,7 @@
#include <svl/svldllapi.h>
#include <tools/debug.hxx>
#include <svl/poolitem.hxx>
+#include <cassert>
class SVL_DLLPUBLIC CntUnencodedStringItem: public SfxPoolItem
{
@@ -60,8 +61,7 @@ public:
inline void CntUnencodedStringItem::SetValue(const OUString & rTheValue)
{
- DBG_ASSERT(GetRefCount() == 0,
- "CntUnencodedStringItem::SetValue(): Pooled item");
+ assert(GetRefCount() == 0 && "cannot modify name of pooled item");
m_aValue = rTheValue;
}
diff --git a/include/svl/itempool.hxx b/include/svl/itempool.hxx
index 7f74cb85c11d..3a2ff084d723 100644
--- a/include/svl/itempool.hxx
+++ b/include/svl/itempool.hxx
@@ -171,6 +171,12 @@ public:
sal_uInt32 GetItemCount2(sal_uInt16 nWhich) const;
Item2Range GetItemSurrogates(sal_uInt16 nWhich) const;
+ /*
+ This is only valid for SfxPoolItem that override IsSortable and operator<.
+ Returns a range of items defined by using operator<.
+ @param rNeedle must be the same type or a supertype of the pool items for nWhich.
+ */
+ std::vector<const SfxPoolItem*> FindItemSurrogate(sal_uInt16 nWhich, SfxPoolItem const & rNeedle) const;
sal_uInt16 GetFirstWhich() const;
sal_uInt16 GetLastWhich() const;