From cfc3eeea1b3fbf31998deef65fb01214d44d36fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lund=20Martsum?= Date: Mon, 1 Oct 2012 06:42:28 +0200 Subject: 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 Reviewed-by: Lars Knoll --- tests/benchmarks/corelib/tools/qmap/main.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/benchmarks') 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 map; + for (int i = 0; i < 100000; ++i) + map.insert(i, i); + + QBENCHMARK { + std::map n = map.toStdMap(); + n.begin(); + } +} QTEST_MAIN(tst_QMap) -- cgit v1.2.3