[Qt-interest] QString ot QUuid for QHash and QMap keys?

Andre Somers andre at familiesomers.nl
Fri Oct 21 19:13:59 CEST 2011


Op 21-10-2011 19:08, Jason H schreef:
> I am wondering which if the following results in fastest lookups. I've 
> got about 500-100o items in the collection, and I will constantly be 
> doing lookups as the system gets the UUID for an object then proceeds 
> to manipulate that object potentially several times a second, for each 
> object.
> QMap<QUuid, QObject*>
> QHash<QUuid, QObject*>
> QMap<QString, QObject*>
> QHash<QString, QObject*>
> Where the string keys are a QUuid::toString().mid(1,36) (trims the 
> curley braces).
> Also, why isn't there a toString() version that will just give me a 
> string without the braces? I keep making Uuids, converting them to 
> strings and cutting the braces off.
> Thanks.
The QHash versions are going to be faster than the QMap ones, but I am 
not sure which of the hashes will be faster. I guess the QUuid one, but 
that would be easy enough to benchmark, right?

André

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20111021/fb6d912a/attachment.html 


More information about the Qt-interest-old mailing list