Using HashMap over QMap

Maik Qualmann metzpinguin at
Thu Jul 9 18:22:13 BST 2020

A QHashMap brings a speed advantage for a large number of entries, because 
access is constant time. A QMap can be faster with a few, say up to 200 
entries. With Qt4 there were sometimes problems if the key was a string in a 
QHashMap, which was not unique when converted to a hash. That should no longer 
occur with Qt5. So, many thousands of entries with a lot of access -> 
QHashMap. Keep in mind that the keys of a QMap are sorted automatically.


Am Donnerstag, 9. Juli 2020, 15:24:31 CEST schrieb Kartik Ramesh:
> Hi all,
> I was working on categorizing Face Suggestions by Suggested Name. This
> would lead to a grouping of similar faces, which would be particularly
> helpful in the Unconfirmed Tag View.
> To do the categorization, I have been able to implement methods to obtain a
> Map of Face Regions -> Suggested Names for each Image. This would have
> multiple elements if an image has multiple faces. I have committed the
> implementation already.
> Since, I don't have any reason for my keys to be sorted, I was wondering if
> I should use a HashMap instead of a QMap?  I have currently used a QMap
> because all methods related to Faces use it.
> Thanks in advance
> Kartik

More information about the Digikam-devel mailing list