- Joined
- Jan 15, 2019
At zstd level 1 (what's used by zswap), zstd is 25% "slower" than lz4, at about 510 vs 675mb/sec (from facebook's lzbench, single-thread, on a Core i7-9700K at 4.9GHz), but with a compression ratio of 2.90 vs 2.10. Decompression is about 2.5x slower, "only" 1550MB/sec compared to 3850MB/sec.It is, but I also heard that it's more CPU intensive so I decided to go with lz4 and I had no issues. I think I will continue using lz4 on my decade + old laptop but try out zstd on the desktop.
510MB/sec writes to and 1550MB/sec reads from swap is still "fucking fast." Memory reclaim is not nearly that demanding. The rest of your hardware will not be keeping up with that theoretical maximum under regular use cases anyway. lz4 works with "no issues" because it's designed to, but so is zstd, which also works with no issues. Give it a shot; you can always switch back. You shouldn't observe any slowdowns in practical use and you'll probably notice you can "cram more in there" before it starts hitting the physical disk. Switching compressors doesn't even require a reboot. It's just applied to new pages compressed after the change, with pages compressed with the previous method still accessible (and recompressed later with zstd instead of they go back into zswap).
CPUs from a decade ago still "worthy" of laptop life aren't substantially slower at single-core compression and decompression.