summaryrefslogtreecommitdiff
path: root/sw/inc/docstyle.hxx
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2014-07-02 10:14:15 +0100
committerMichael Meeks <michael.meeks@collabora.com>2014-07-02 10:53:44 +0100
commit64b1566e55677217c9c0dd13e5fbf8faf40810f9 (patch)
tree48f598390f35c326731f31510636722de58f5449 /sw/inc/docstyle.hxx
parent8871a650b951a012a251a72aa1d3de46628d4c2d (diff)
fdo#76260 - switch O(N^2) lookup in SwStyleSheetIterator to O(N)
The SwStyleSheetIterator is called a lot on import of DOCX; potentially another N times - so this change saves 15%+ of load time, 81bn cycles of 457bn to startup and load the document. Change-Id: I70ef0f1ebd3f4e05519be68c8a67f65b00f54719
Diffstat (limited to 'sw/inc/docstyle.hxx')
-rw-r--r--sw/inc/docstyle.hxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx
index 63a30e020de5..086207704614 100644
--- a/sw/inc/docstyle.hxx
+++ b/sw/inc/docstyle.hxx
@@ -25,6 +25,7 @@
#include <svl/style.hxx>
#include <svl/itemset.hxx>
#include "swdllapi.h"
+#include <boost/unordered_map.hpp>
#include <vector>
@@ -141,10 +142,13 @@ class SwStyleSheetIterator : public SfxStyleSheetIterator, public SfxListener
class SwPoolFmtList
{
std::vector<OUString> maImpl;
+ typedef boost::unordered_map<OUString, sal_uInt32, OUStringHash> UniqueHash;
+ UniqueHash maUnique;
+ void rehash();
public:
SwPoolFmtList() {}
void Append( char cChar, const OUString& rStr );
- void Erase() { maImpl.clear(); }
+ void clear() { maImpl.clear(); maUnique.clear(); }
size_t size() { return maImpl.size(); }
bool empty() { return maImpl.empty(); }
sal_uInt32 FindName(SfxStyleFamily eFam, const OUString &rName);