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>
This commit is contained in:
parent
90351e40fd
commit
655374529c
@ -172,7 +172,7 @@ void tst_QMap::lookup_int_string()
|
||||
|
||||
QBENCHMARK {
|
||||
for (int i = 0; i < 100000; ++i)
|
||||
str += map.value(i);
|
||||
str = map.value(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user