[Interest] QSqlDatabase and Multithreading

Philipp Kursawe phil.kursawe at gmail.com
Thu Jan 23 05:54:36 CET 2014


Ah that explains it! Thanks for the benchmarks. We only tested it with the
old 4.8 implementation and decided to go with std::mutex instead. We might
check out QMutex again!
Does it support the behaviour of std::recursive_mutex?


On Wed, Jan 22, 2014 at 11:16 PM, Thiago Macieira <thiago.macieira at intel.com
> wrote:

> 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
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140123/29b88cbb/attachment.html>


More information about the Interest mailing list