summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2021-07-20 15:55:41 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-07-21 21:05:32 +0000
commitee2a45db6b49cb1f4d4c57f529ec239b22c853ac (patch)
tree0edb38709febb48093893d7ef7f6f48da3556735
parentc04302a40b5497cedb68caeab1182f848a219acd (diff)
Don't slow down a QMap benchmark by growing a megabyte-long string
Change a += to simple assignment where it's string arithmetic (a hundred thousand concatenations of "Hello World" add up to more than a megabyte, in an incremental growth that's going to dominate the QMap operations we were meant to be benchmarking) and the only reason for it is to avoid an unused result warning. Accumulating int values is harmless, but strings are another story ! Task-number: QTBUG-91713 Change-Id: Ib0dc131b0cc75fea23998afc0300e8cb60076c7e Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit 2e24ee02af30821200876bcc0c308ee844155aec) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--tests/benchmarks/corelib/tools/qmap/main.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/benchmarks/corelib/tools/qmap/main.cpp b/tests/benchmarks/corelib/tools/qmap/main.cpp
index 50cc853df6..61b00b8a0d 100644
--- a/tests/benchmarks/corelib/tools/qmap/main.cpp
+++ b/tests/benchmarks/corelib/tools/qmap/main.cpp
@@ -156,7 +156,7 @@ void tst_QMap::lookup_int_string()
QBENCHMARK {
for (int i = 0; i < 100000; ++i)
- str += map.value(i);
+ str = map.value(i);
}
}