Using HashMap over QMap
kartikx2000 at gmail.com
Thu Jul 9 18:32:47 BST 2020
Thank you for the insight. I wasn't aware that a QMap would perform better
for smaller entries. Since my map would contain only small number of
entries on average (as number of faces in an image will not be very large),
I think I should stick with the QMap implementation.
On Thu, 9 Jul 2020, 22:54 Maik Qualmann, <metzpinguin at gmail.com> wrote:
> 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
> QHashMap, which was not unique when converted to a hash. That should no
> 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
> > 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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Digikam-devel