diff options
author | Mårten Nordheim <marten.nordheim@qt.io> | 2019-11-06 18:04:45 +0100 |
---|---|---|
committer | Mårten Nordheim <marten.nordheim@qt.io> | 2019-12-12 15:25:30 +0100 |
commit | d98a1ef902527ca2351ec6bf18872a4226953487 (patch) | |
tree | 6594fdbdb40f75f4b87d9fd23d04f3e68dbff8f5 /tests/benchmarks/corelib/tools | |
parent | 9c124b1b0a3730978699b8a6420308b5e5ab4e4e (diff) |
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 <lars.knoll@qt.io>
Diffstat (limited to 'tests/benchmarks/corelib/tools')
-rw-r--r-- | tests/benchmarks/corelib/tools/qmap/main.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
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<int, int> map; + for (int i = 0; i < 100000; ++i) + map.insert(i * 4, 0); + QMap<int, int> 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" |