GNOME Bugzilla – Bug 734651
Resizing gtk3-iconbrowser is super slow
Last modified: 2014-08-12 13:48:07 UTC
When showing a page with a lot of icons (for instance "Other") resizing the window is super slow. Especially when showing symbolic icons. The reason for this is obvious if you run "strace -eopen gtk3-icon-browser", it is constantly reloading/parsing the icon files from disk (visible always for symbolics and for pngs if you don't have image data in your icon cache). This happens because during size request we're reusing a single GtkIconHelper for all the icons in the icon view, asking for the preferred size. The _gtk_icon_helper_get_size() calls _gtk_icon_helper_ensure_surface() which loads the icon. For small pages the icon cache will keep all icons on the page in the cache, so this is fast. However, for larger pages (and since we never keep individual GtkIconInfos alive) we will constantly be trashing the cache and reloading the icons when iterating over all icons during the size request.
Created attachment 283173 [details] [review] GtkIconHelper: Short circuit _gtk_icon_helper_get_size in some cases _gtk_icon_helper_get_size() is often used during size request and may not necessary mean that the icon will be displayed immediately. In many common cases we know the size without having to ensure a surface. In many cases this means we can avoid loading an icon until needed, and in the case of stateless IconHelpers such as GtkCellRendererPixbuf this is very important as otherwise it will constantly be reloading icons if the displayed set is larger than the in-memory icon cache.
Review of attachment 283173 [details] [review]: this will not make my 'image scaling' branch easier (where I try to make GtkImage scale its content to fit), but I think the speedup is worth it.
Attachment 283173 [details] pushed as 928822f - GtkIconHelper: Short circuit _gtk_icon_helper_get_size in some cases