←back to thread

150 points shaunpud | 1 comments | | HN request time: 0.202s | source
Show context
ars ◴[] No.45060177[source]
File is tmpfs will swap out if your system is under memory pressure.

If that happens, reading the file back is DRAMATICALLY slower than if you had just stored the file on disk in the first place.

This change is not going to speed things up for most users, it will slow things. Instead of caching important files, you waste memory on useless temporary files. Then the system swaps it out, so you can get cache back, and then it's really slow to read back.

This change is a mistake.

replies(3): >>45060209 #>>45060221 #>>45061213 #
saurik ◴[] No.45060209[source]
Why is reading the data back from swap be slower at all -- much less "DRAMATICALLY" so -- than saving the data to disk and reading it back?
replies(1): >>45060257 #
cwillu ◴[] No.45060257[source]
Because swapping back in happens 4kb at a time
replies(2): >>45060816 #>>45061751 #
mnw21cam ◴[] No.45061751[source]
It's also because a filesystem is much more likely to have consecutive parts of a file stored consecutively on disc, whereas swap is going to just randomly scatter 4kB blocks everywhere, so you'll be dealing with random access read speed instead of throughput read speed.
replies(1): >>45062806 #
blueflow ◴[] No.45062806[source]
Valid argument with FAT on spinning rust, invalid with ext4 on ssd. ext4 is extent-based so the fragmentation overhead doesn't happen.
replies(1): >>45063339 #
Suzuran ◴[] No.45063339[source]
The swap partition does not have a filesystem, it is a linear list of blocks.
replies(2): >>45063420 #>>45063424 #
blueflow ◴[] No.45063424[source]
Neither i nor parent said that. Confusion?
replies(2): >>45067147 #>>45071497 #
ars ◴[] No.45067147[source]
You wrote your comment like it was a rebuttal of the person above you, but the text supports what they said: A filesystem is faster than swap for this.

What was your intent?

replies(1): >>45067717 #
1. ◴[] No.45067717[source]