logoalt Hacker News

koala_mantoday at 7:16 PM1 replyview on HN

> Swap files have had the same performance characteristics as swap partitions for more than 20 years

I thought so too, then I benchmarked it on a (spinning rust) HDD and found it was significantly slower:

https://www.vidarholen.net/contents/blog/?p=1110

tl;dr: "In this test, using a swap file was surprisingly 50%+ slower than simply allocating a swap partition at the start of the drive, in spite of the low fragmentation and Linux’s bypass of the FS layer."


Replies

Aurornistoday at 7:20 PM

> hen I benchmarked it on a (spinning rust) HDD

Yes, but as your article notes HDDs have different performance characteristics depending on where the sectors are physically located on the platter.

If you could force the swapfile to the same location on the platter it shouldn't perform differently.

Most people are going to be using solid state where this doesn't matter.

show 1 reply