One more patch (thumbnail text height calculation)
Robert Krawitz <rlk-FrUbXkNCsVf2fBVCVOL8/[email protected]> Sun, 12 Jan 2020 18:07:34 -0500 (EST)
| Newsgroups | gmane.comp.kde.kimdaba |
|---|---|
| Message-ID | <20200112230734.37E964249B2@localhost> |
I was trying to squeeze a bit more and when profiling found that a surprising amount of time was being spent just calculating the height of the text area in the thumbnail view. That's because it loops over all of the categories on an image, checks that they're not the folder name or media type, and checks that the set of items in that category is not empty. Eliminating that, by simply taking the number of categories on the image and subtracting 2 (all images have a media type and at least one folder), makes a noticeable difference when displaying a large number of thumbnails (in my case, currently about 380K images, modestly fewer thumbnails because of stacks). It's not an overwhelming difference, but it's very much noticeable with that many thumbnails. The biggest overhead right now seems to be setting up the map widget, particularly the first time through when it dynamically loads a bunch of stuff. I don't use that personally. -- Robert Krawitz <rlk-FrUbXkNCsVf2fBVCVOL8/[email protected]> *** MIT Engineers A Proud Tradition http://mitathletics.com *** Member of the League for Programming Freedom -- http://ProgFree.org Project lead for Gutenprint -- http://gimp-print.sourceforge.net "Linux doesn't dictate how I work, I dictate how Linux works." --Eric Crampton _______________________________________________ KPhotoAlbum mailing list [email protected] https://mail.kdab.com/mailman/listinfo/kphotoalbum
thumbnail-text-height-calculation.patch
(application/octet-stream, 1 KB)
diff --git a/ThumbnailView/CellGeometry.cpp b/ThumbnailView/CellGeometry.cpp
index 52354479..992864a8 100644
--- a/ThumbnailView/CellGeometry.cpp
+++ b/ThumbnailView/CellGeometry.cpp
@@ -68,22 +68,12 @@ QRect ThumbnailView::CellGeometry::iconGeometry(const QPixmap &pixmap) const
}
/**
- * return the number of categories with valies in for the given image.
+ * return the number of categories with values in for the given image.
*/
static int noOfCategoriesForImage(const DB::FileName &image)
{
- int catsInText = 0;
QStringList grps = image.info()->availableCategories();
- for (QStringList::const_iterator it = grps.constBegin(); it != grps.constEnd(); ++it) {
- QString category = *it;
- if (category != i18n("Folder") && category != i18n("Media Type")) {
- StringSet items = image.info()->itemsOfCategory(category);
- if (!items.empty()) {
- catsInText++;
- }
- }
- }
- return catsInText;
+ return grps.length() - 2; // Exclude folder and media type
}
/**