summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qdatastream.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2012-03-19 20:53:20 +0100
committerQt by Nokia <qt-info@nokia.com>2012-03-23 09:31:09 +0100
commit5cb0368516abd293daf67711a36bbacc99422e9a (patch)
tree389b493f44b87c0f944081817ee3cfc4ebb420c8 /src/corelib/io/qdatastream.h
parent3f7741fbe7ab4140f8f971c0cf88bb04e7feea6b (diff)
Rewrite QMap to use a RB tree
QMap used to use a skiplist in Qt 4.x, which has variable sized nodes and we can thus not optimise using custom allocators. The rewrite now uses a red-black tree, and all allocations and tree operations happen in the cpp file. This will allow us to introduce custom allocation schemes in later versions of Qt. Added some more tests and a benchmark. Memory consumption of the new QMap implementation is pretty much the same as before. Performance of insertion and lookup has increased by 10-30%. iteration is slower, but still extremely fast and should not matter compared to the work usually done when iterating. Change-Id: I8796c0e4b207d01111e2ead7ae55afb464dd88f5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io/qdatastream.h')
-rw-r--r--src/corelib/io/qdatastream.h2
1 files changed, 0 insertions, 2 deletions
diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h
index 451a7ab959..533911974a 100644
--- a/src/corelib/io/qdatastream.h
+++ b/src/corelib/io/qdatastream.h
@@ -385,7 +385,6 @@ Q_OUTOFLINE_TEMPLATE QDataStream &operator>>(QDataStream &in, QMap<aKey, aT> &ma
in >> n;
map.detach();
- map.setInsertInOrder(true);
for (quint32 i = 0; i < n; ++i) {
if (in.status() != QDataStream::Ok)
break;
@@ -395,7 +394,6 @@ Q_OUTOFLINE_TEMPLATE QDataStream &operator>>(QDataStream &in, QMap<aKey, aT> &ma
in >> key >> value;
map.insertMulti(key, value);
}
- map.setInsertInOrder(false);
if (in.status() != QDataStream::Ok)
map.clear();
if (oldStatus != QDataStream::Ok)