qt-interest@trolltech.com
[Top] [All Lists]

Re: Qt vs. STL benchmark?

Subject: Re: Qt vs. STL benchmark?
From: Justin Noel
Date: Wed, 06 Aug 2008 13:09:25 -0400

Gordon Schumacher wrote:
Is anyone aware (or has someone written) a performance benchmark testing various functions to compare the Qt containers to the STL containers? It would be helpful to know what the best route is for performance-critical code.

(And yes, I'm aware that STL isn't universally compatible with itself and all that - never mind that argument, it's not relevant in our case; and yes, I'm aware that one might well be better off using flat code in some circumstances. I'm looking for "if I'm gonna use a template class for X, which one will be faster?")



I've always heard that the Qt Containers usually trade a little performance for memory footprint. However, I've never really benchmarked them to see how much the performance differs. This page http://doc.trolltech.com/4.4/containers.html lists the algorithmic complexity of the Qt Containers.

One of the coolest features for the Qt Containers is that they are all implicitly shared. So making/returning copies of containers isn't a performance killer. Also most of the Qt data structures are implicitly shared, so copying the values of dereferenced iterators isn't a big deal. This will keep you from shooting yourself in the foot inside own code with regards to performance. There was a talk at one of the Dev Days (I think Qt Internals by Bradley Hughes) that discussed how they implemented their implicitly shared classes (with atomic ref count) and how you can do the same thing.

Good Luck!
--Justin

Attachment: justin.vcf
Description: Vcard

<Prev in Thread] Current Thread [Next in Thread>