Bug 423537 - hold N previews in memory (i.e. multi-level preview caching)
Summary: hold N previews in memory (i.e. multi-level preview caching)
Status: REPORTED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-26 11:10 UTC by Harald Sitter
Modified: 2020-11-02 07:18 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Harald Sitter 2020-06-26 11:10:12 UTC
Not super sure who should do this, might be KIO.

When one browses through directories there's a good chance one may go up and down and up and down. The trouble is every time the dir changes we PreviewJob the new entries even when we know that they haven't changed. At the best of times that will simply result in the job poking the thumbnailer and the thumbnailer reading the cache file from disk, over and over again. At the worst of times the previewable content has caching disabled entirely (Text thumbs, directory thumbs) and we spend energy on needlessly updating stuff all the time. The current way of doing things also means there can be a noticeable amount of time between going up to the previous directory and the (unchanged) previews appearing again.

To improve things I'd propose having a global static FIFO in-memory cache of previews with some N entries that attaches a QFileSystemWatcher or something to kick the cache entry out in case the file changes.
When loading previews for $URI first try to pop them out of the in-memory cache and only if that misses start a PreviewJob.

For example:
I'm in dolphin's src dir and descend into the views dir only to find that the file I was looking for is in fact not here so I go back up and into the kitemviews dir instead.
Comment 1 Elvis Angelaccio 2020-08-30 22:10:47 UTC
> At the best of times that will simply result in the job poking the thumbnailer and the thumbnailer reading the cache file from disk, over and over again

What's wrong with this? Repeated disk access?

> At the worst of times the previewable content has caching disabled entirely (Text thumbs, directory thumbs) 

Can't we enable caching for those?
Comment 2 Harald Sitter 2020-08-31 09:13:53 UTC
(In reply to Elvis Angelaccio from comment #1)
> > At the best of times that will simply result in the job poking the thumbnailer and the thumbnailer reading the cache file from disk, over and over again
> 
> What's wrong with this? Repeated disk access?

Repeated disk access. But also general speed. When going up and down a dir structure there's a noticeable delay in the same thumbs appearing. I'm sure part of it is KIO's fault though (as per the bugs below).

> > At the worst of times the previewable content has caching disabled entirely (Text thumbs, directory thumbs) 
> 
> Can't we enable caching for those?

https://bugs.kde.org/show_bug.cgi?id=423541
https://bugs.kde.org/show_bug.cgi?id=423736
https://bugs.kde.org/show_bug.cgi?id=423538