summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/corelib
diff options
context:
space:
mode:
authorThorbjørn Lund Martsum <tmartsum@gmail.com>2012-10-01 06:42:28 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-27 07:35:48 +0200
commitcfc3eeea1b3fbf31998deef65fb01214d44d36fd (patch)
tree5ecc5d35ccb932179e959e591643d119304d0169 /tests/benchmarks/corelib
parent67a0f546c507d4113de895df297815adcb5d489e (diff)
QMap - use hint on insert in QMap::toStdMap
Giving the std-map a hint (normally) improves insert performance. There seems to be no reason not to provide this hint. Change-Id: I4344607ebf54574a3ae9666d87a41a3c14762361 Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests/benchmarks/corelib')
-rw-r--r--tests/benchmarks/corelib/tools/qmap/main.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/benchmarks/corelib/tools/qmap/main.cpp b/tests/benchmarks/corelib/tools/qmap/main.cpp
index 05b52ba42f..c3b9c18cd2 100644
--- a/tests/benchmarks/corelib/tools/qmap/main.cpp
+++ b/tests/benchmarks/corelib/tools/qmap/main.cpp
@@ -60,6 +60,7 @@ private slots:
void lookup_string_int();
void iteration();
+ void toStdMap();
};
@@ -159,6 +160,17 @@ void tst_QMap::iteration()
}
}
+void tst_QMap::toStdMap()
+{
+ QMap<int, int> map;
+ for (int i = 0; i < 100000; ++i)
+ map.insert(i, i);
+
+ QBENCHMARK {
+ std::map<int, int> n = map.toStdMap();
+ n.begin();
+ }
+}
QTEST_MAIN(tst_QMap)