On my work computer I've noticed that some icon-theme.cache
files are very large. For example:
/usr/share/icons/hicolor/icon-theme.cache
: 120MB/usr/share/icons/gnome/icon-theme.cache
: 113MB/usr/share/icons/pacifica/icon-theme.cache
: 103MB/usr/share/icons/oxygen/icon-theme.cache
: 94MB
etc. What could be the reason for this? For example, on my home computer, /usr/share/icons/hicolor/icon-theme.cache
is only 24kB big, and others are even smaller than that.
Can I delete these files (will they auto-regenerate)? Or is there any other way to shrink them?
The icon theme cache contains an index of the image files contained in the directory, and can optionally include the corresponding uncompressed image data.
The rationale for including image data was that instead of opening and decoding each individual image file, the app would just memory map the cache file and access it directly.
The default used to be to include image data in the cache, but this was changed in mid 2014. The main reason for this was that the format used to store raw image data in the cache no longer matched what was used for displaying the images, so it was no longer offering zero copy access. Also, the improvements in CPU speeds over the years relative to hard disk speeds mean it is not obvious that avoiding the need to decompress data is a win when it means reading more data off disk.
So getting back to the original question: the reason the caches are smaller on your home system compared to your work system is most likely because the work system is running an older distribution release where the caches have been built to include image data. When the work system is upgraded, its cache sizes should shrink.
Yeah, they are really so huge. Their generation is triggered separately by
dpkg
if there is any new file during installation of packages.You can remove them
Then force regenerating them
The system can work without cache, just little drop in GUI performance.