qt5base-lts/tests/benchmarks/corelib
Edward Welbourne 23434f487b QMap benchmark: use unsigned accumulators and check them
The sum of the first 100000 naturals is more than 2^32, so using an
int accumulator to collect the values is susceptible to overflow,
which is UB for signed integral types. So switch to an unsigned type.
We don't care about the actual sum, only having the various map
entries we fetch "used".

Since unsigned arithmetic is well-defined even when it overflows, we
can calculate the expected sum and verify it, to ensure that no matter
how clever the optimizer, it won't throw out the accumulator as
written but not read (and then optimize out all the tested code).

As a drive-by, rename one of the accumulators to match the rest.

Change-Id: I93a2825247c96ca88fe52fdb7ce1e5456eebad54
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-07-23 17:19:12 +02:00
..
io Rename QFile benchmark's source file to tst_bench_qfile.cpp 2021-07-19 11:31:59 +02:00
itemmodels Add QSortFilterProxyModel clear-filter benchmark 2021-04-25 13:25:01 +03:00
json Remove qmake project files for benchmarks 2021-02-01 21:14:01 +01:00
kernel Fix QMetaType API deprecation warning in benchmark 2021-04-26 10:59:32 +02:00
mimetypes Remove qmake project files for benchmarks 2021-02-01 21:14:01 +01:00
plugin Fix some warnings 2021-03-29 16:06:25 +02:00
text Add benchmarks for QString::number 2021-07-22 23:01:41 +02:00
thread Add basic benchmarks for QFuture 2021-06-19 08:48:14 +02:00
time Make loop variables references in date benchmark 2021-04-27 15:34:50 +02:00
tools QMap benchmark: use unsigned accumulators and check them 2021-07-23 17:19:12 +02:00
CMakeLists.txt Add QSortFilterProxyModel clear-filter benchmark 2021-04-25 13:25:01 +03:00