[Interest] QSqlDatabase and Multithreading
Thiago Macieira
thiago.macieira at intel.com
Wed Jan 22 23:16:35 CET 2014
On quarta-feira, 22 de janeiro de 2014 22:01:39, Philipp Kursawe wrote:
> sorry got that mixed up. Qt uses Events under Windows (was that changed in
> Qt5?), which is still not as efficient as CriticalSections.
Yes, QMutex got a large rewrite in Qt 5.
I'd like to see your benchmarks. This is what the one in
tests/benchmarks/corelib/thread/qmutex say:
Non-recursive mutex:
- QMutex construction time and CriticalSection construction time are very
efficient. QMutex is 15.8% faster.
- QMutex performance with uncontended locks is very good too. QMutex is 29.8%
faster
- for contended mutexes, QMutex also wins: 36.5% faster on the 1-mutex
testcase, 49.2% faster on the 2-mutex case
Recursive mutex:
- QMutex construction is much worse, since it needs to allocate memory; 5.4x
worse
- uncontended locks: QMutex is 48% slower
- contended locks: QMutex is between 100% to 500% slower
The recursive QMutex and the critical section objects are very much alike. The
only reason I can think of for why QMutex is that much slower is due to the
indirection and extra memory allocation.
For Qt 6, it might be a good idea to make QMutex bigger so it can store the
fields for a recursive mutex without indirection and memory allocation.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140122/5f43d20b/attachment.sig>
More information about the Interest
mailing list