3 ms·
Yes, to a certain degree. The problem is that it would be cheaper to, say, drop a decoded version of a JPEG and re-decode it, instead of having it get swapped o
by ori_b 17y ago
Yes, to a certain degree. The problem is that it would be cheaper to, say, drop a decoded version of a JPEG and re-decode it, instead of having it get swapped out. In fact, I suspect that for large images, it would be cheaper to re-read the compressed jpeg and decompress it than to read back a larger swapped out decompressed version, just because hitting the disk is slow, and swap tends to get fragmented because it's usually written a few pages at a time.
Swap hints probably aren't really worth the effort, although I haven't benchmarked it.
The idea behind caches is to avoid doing expensive operations repeatedly, and hitting swap is about as expensive as an operation can get.