Skip to content

Make thumbnail generation more dynamic

Arjen Hiemstra requested to merge work/ahiemstra/thumbnails into master

With !47 (merged) and its dependency images can be browsed while the directory is loading. However, no thumbnails will be shown until the directory has completed loading, which can be a long time. This MR contains changes to address that:

  • Do not constantly reset the thumbnail generation timer on data change, so we actually generate thumbnails while things are loading.
  • Only generate thumbnails for things that can reasonably be considered visible or soon to be visible, rather than the entire directory.
  • Discard in-memory thumbnails of things that are no longer visible.

The last two items have as an additional positive effect that memory usage for larger directories is reduced significantly. For my testing directory containing 10000 images, the difference is that it will now remain steady at ~160MiB whereas my system's Gwenview will keep loading thumbnails, easily reaching 2GiB of memory usage and eventually getting killed by the oomkiller since it loads too much.

Edited by Arjen Hiemstra

Merge request reports