summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextformat_p.h
diff options
context:
space:
mode:
authorJos van den Oever <jos@vandenoever.info>2009-10-01 16:49:27 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-11-13 10:29:10 (GMT)
commit60d2ab05c350f866f942a35f341f455015fdb800 (patch)
tree206aa7567c25c5a85cebe2938d924b6159d3a5f9 /src/gui/text/qtextformat_p.h
parente6be9c88bc98481936fcba7fa1cfb4e255f6e30b (diff)
downloadQt-60d2ab05c350f866f942a35f341f455015fdb800.zip
Qt-60d2ab05c350f866f942a35f341f455015fdb800.tar.gz
Qt-60d2ab05c350f866f942a35f341f455015fdb800.tar.bz2
Speed up QTextFormatCollection::indexForFormat
QTextFormatCollection currently has two problems: - looking for the index of a QTextFormat is linear, this can take 25% cpu when loading large documents in kword - the hash function for QTextFormat is inadequate. Not all values are treated specially. E.g. each QBrush instance has the same hash value at the moment. These patches speed up loading of a large text document in KWord from 9 to 7 seconds. This fixes this by using QMultiHash to group the QTextFormat instances by hash and only loop through that list when looking up values. It also improves the hash function for QTextFormat. Merge-request: 1623 Reviewed-by: Olivier Goffart <ogoffart@trolltech.com>
Diffstat (limited to 'src/gui/text/qtextformat_p.h')
-rw-r--r--src/gui/text/qtextformat_p.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/text/qtextformat_p.h b/src/gui/text/qtextformat_p.h
index c796343..73ca0ce 100644
--- a/src/gui/text/qtextformat_p.h
+++ b/src/gui/text/qtextformat_p.h
@@ -55,7 +55,7 @@
#include "QtGui/qtextformat.h"
#include "QtCore/qvector.h"
-#include "QtCore/qset.h"
+#include "QtCore/qhash.h"
QT_BEGIN_NAMESPACE
@@ -97,7 +97,7 @@ public:
FormatVector formats;
QVector<qint32> objFormats;
- QSet<uint> hashes;
+ QMultiHash<uint,int> hashes;
inline QFont defaultFont() const { return defaultFnt; }
void setDefaultFont(const QFont &f);