qt5base-lts/tests/benchmarks/corelib
Marc Mutz 6a1a936537 QWaitCondition: also benchmark std::condition_variable{,_any}
Results on my machine (only forever results):

********* Start testing of tst_QWaitCondition *********
Config: Using QtTest library 6.3.0, Qt 6.3.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 11.2.1 20211115), ubuntu 20.04
PASS   : tst_QWaitCondition::oscillate_QWaitCondition_QMutex(forever)
RESULT : tst_QWaitCondition::oscillate_QWaitCondition_QMutex():"forever":
     637 msecs per iteration (total: 637, iterations: 1)
PASS   : tst_QWaitCondition::oscillate_QWaitCondition_QReadWriteLock(forever)
RESULT : tst_QWaitCondition::oscillate_QWaitCondition_QReadWriteLock():"forever":
     909 msecs per iteration (total: 909, iterations: 1)
PASS   : tst_QWaitCondition::oscillate_std_condition_variable_std_mutex(forever)
RESULT : tst_QWaitCondition::oscillate_std_condition_variable_std_mutex():"forever":
     331 msecs per iteration (total: 331, iterations: 1)
PASS   : tst_QWaitCondition::oscillate_std_condition_variable_any_QMutex(forever)
RESULT : tst_QWaitCondition::oscillate_std_condition_variable_any_QMutex():"forever":
     627 msecs per iteration (total: 627, iterations: 1)
PASS   : tst_QWaitCondition::oscillate_std_condition_variable_any_QReadWriteLock(forever)
RESULT : tst_QWaitCondition::oscillate_std_condition_variable_any_QReadWriteLock():"forever":
     913 msecs per iteration (total: 913, iterations: 1)

~331 vs. ~630ms. A pretty significant win (2x).

Mårten noticed that on Windows, condition_variable::wait_for(x, 0ms)
will not unlock the mutex, which, however, the program requires, so
use a 1ns timeout instead.

Drive-by fixes:
- add override to run() reimplementations
- fix type of timeout member variable (was int, should be unsigned long)
- fix naming of test functions to distinguish better between QMutex
  and std::mutex

Change-Id: Ib92310f15fbd58258b2043504642be5f0b860f39
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-11-26 18:28:50 +01:00
..
io QtBase: replace windows.h with qt_windows.h 2021-11-23 12:53:46 +08:00
itemmodels Standardise layout and naming in corelib benchmarks 2021-08-30 19:21:08 +02:00
json Remove qmake project files for benchmarks 2021-02-01 21:14:01 +01:00
kernel Standardise layout and naming in corelib benchmarks 2021-08-30 19:21:08 +02:00
mimetypes Standardise layout and naming in corelib benchmarks 2021-08-30 19:21:08 +02:00
plugin Standardise layout and naming in corelib benchmarks 2021-08-30 19:21:08 +02:00
text Standardise layout and naming in corelib benchmarks 2021-08-30 19:21:08 +02:00
thread QWaitCondition: also benchmark std::condition_variable{,_any} 2021-11-26 18:28:50 +01:00
time Standardise layout and naming in corelib benchmarks 2021-08-30 19:21:08 +02:00
tools Add note to QList benchmark about known bug 2021-08-30 19:21:08 +02:00
CMakeLists.txt Add QSortFilterProxyModel clear-filter benchmark 2021-04-25 13:25:01 +03:00