Using HashMap over QMap
metzpinguin at gmail.com
Thu Jul 9 18:42:54 BST 2020
One more thing about the QMap. Please no longer use insertMulti(). Then use a
QMultiMap. The insertMulti() function is deprecated in QT-5.15. I have already
replaced some, but there are still some. With new code, we have to be careful.
Am Donnerstag, 9. Juli 2020, 19:32:47 CEST schrieb Kartik Ramesh:
> 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
> > 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.
> > Maik
> > 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