diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2019-08-23 15:05:32 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2019-09-13 10:47:20 +0200 |
commit | 319c4786036b5f45fc95c683cef5cf5ba2ce2a6d (patch) | |
tree | f0b9894a92572ba6e831d3b913ce6518a89bc50e /src/plugins/platforms/eglfs | |
parent | 68b30a23a8ee66de4da62dcddfe2072c01945c24 (diff) |
QReadWriteLock: replace (QWaitCondition, QMutex) with std::(condition_variable, mutex)
It turns out that QWaitCondition is a std::condition_variable_any. The
_any variant works with any mutex type, but requires a native mutex
for the native condition variable. So, QWaitCondition and
std::condition_variable_any both require two different mutexes: the
one the user passes in, and an internal one.
std::condition_variable, however, only works with std::mutex, and
since both are backed by the native API, condition_variable can use
the mutex passed in by the user instead of having to use an internal
one.
So, port from 2 × QWaitCondition + QMutex (2 × native cond + 2 ×
native mutex + Qt mutex) to std::condition_variable + std::mutex (2 ×
native cond + native mutex), shaving the overhead of two additional
mutexes (one Qt, one native) as well as the memory allocation
performed by QWaitCondition (for its Private).
Speeds up the writeOnly case by ~1/8th:
PASS : tst_QReadWriteLock::writeOnly(QReadWriteLock)
RESULT : tst_QReadWriteLock::writeOnly():"QReadWriteLock":
- 39,703 msecs per iteration (total: 39,703, iterations: 1)
+ 34,950 msecs per iteration (total: 34,950, iterations: 1)
Change-Id: I196cb13a27242fc1cb99723dfab5b2e5f8522143
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/plugins/platforms/eglfs')
0 files changed, 0 insertions, 0 deletions