From d98a1ef902527ca2351ec6bf18872a4226953487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Wed, 6 Nov 2019 18:04:45 +0100 Subject: Add QMap::insert(const QMap &map) As opposed to unite(), this inserts one map into the other without duplicating elements. Task-number: QTBUG-35544 Change-Id: Ie8ab350b29148851a3176cef1007e8a4ca82c273 Reviewed-by: Lars Knoll --- tests/benchmarks/corelib/tools/qmap/main.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/benchmarks') diff --git a/tests/benchmarks/corelib/tools/qmap/main.cpp b/tests/benchmarks/corelib/tools/qmap/main.cpp index ce415212e4..50cc853df6 100644 --- a/tests/benchmarks/corelib/tools/qmap/main.cpp +++ b/tests/benchmarks/corelib/tools/qmap/main.cpp @@ -59,6 +59,8 @@ private slots: void insertion_string_int2(); void insertion_string_int2_hint(); + + void insertMap(); }; @@ -269,6 +271,19 @@ void tst_QMap::insertion_string_int2_hint() } } +void tst_QMap::insertMap() +{ + QMap map; + for (int i = 0; i < 100000; ++i) + map.insert(i * 4, 0); + QMap map2; + for (int i = 0; i < 50000; ++i) + map2.insert(i * 7, 0); + QBENCHMARK_ONCE { + map.insert(map2); + } +} + QTEST_MAIN(tst_QMap) #include "main.moc" -- cgit v1.2.3