Skip to content

fix slow addtion of images in gpsmarkertiler

there was a check for correntTile->imagesId.contains(...) in the loop of addMarkerToTileAndChildren. when adding a lot of images this became very slow as it has to linearly scan through the QList.

by making sure that an image is not in the tiles as a precondition to calling addMarkerToTileAndChildren we can get rid of that check. prior to that check adding images took multiple seconds:

[debug] digikam (../core/utilities/geolocation/mapsearches/gpsmarkertiler.cpp:652) - added  51812  markers in  16.3794  seconds

and afterwards it takes a few milliseconds:

[debug] digikam (../core/utilities/geolocation/mapsearches/gpsmarkertiler.cpp:656) - added  51812  markers in  0.0554487  seconds

the other easy way out would have been to make imagesId a hashset. we can still do this as it would speed up removal of images from the tiles. but this PR (imho) also simplifies things a bit.

i also aligned the behaviour of stopIfEmpty between GPSMarkerTiler and ItemMarkerTiler. so now we always call getTile with stopIfEmpty==true. if we don't see a use for it in the future we can consider removing that argument.

Edited by justus schwartz

Merge request reports