2008-08-31

Thumbnailing in Nautilus

I was just using my laptop and things started slowing down and swapping like crazy and the other application began freezing. Not this again, I though. So, I switched to doing some tasks on the command-line where I got the notice that there was insufficient space left on my hard disk!

Oh dear, I thought, this must be because of the GNOME source code and my build of it. Well, I went about looking for other sources of junk to remove to free some small amount of space. Eventually. A few megabytes here, a few megabytes there. Actually a rather small lunch, but throwing stuff away can be expensive for my heart. Then, however, I found my free lunch! When I tried to check the size of the ~/.thumbnails directory, nothing happened! It kept working on it, and working on it, and working on it, to no avail. I thought: does the programme do anything stupid that requires more space than I have free? Well, that seemed improbable, so I decided to do a heuristic: find out how many files there are there and the average size of a small set of them. I had about 190,000 thumbnails averaging 50kB each! 36 minutes later, they were removed and I had 9GB back!

Some things I wish thumbnailing in GNOME would do:

  • prevent thumbnails from being generated for files within ~/.thumbnails. (That way, you won't infinitely generate them for infinitely many of them
  • either generate the hashed filenames from a hash of the actual file and not its path, so that way, if I move it or make a duplicate, I won't end up with multiple thumbnails; OR, when files are moved (at least in GNOME applications, which doesn't help my terminal behaviour), find the old thumbnail hashed from the old path and then rename it to a hash of the new path. I can see how the first would slow down thumbnailing, though I have a suspicion that the image down sampling isn't that fast either.
  • Better file system organisation of thumbnails. Right now, tens of thousands will accumulate in ~/.thumbnails/normal :|
  • A limit and some accurate way to determine when it was last used, so we can purge ones we never look at after a few months.

So, it's Open Source: why don't I try to do some of this myself? Well, I might, once I get work out of the way to-day :)

0 Comments:

Post a Comment

<< Home