this post was submitted on 25 Jun 2024
26 points (100.0% liked)

Linux

5199 readers
40 users here now

A community for everything relating to the linux operating system

Also check out !linux_memes@programming.dev

Original icon base courtesy of lewing@isc.tamu.edu and The GIMP

founded 1 year ago
MODERATORS
 

cross-posted from: https://sh.itjust.works/post/21361730

Hello, I came across zram recently and I'd like to know if I should use it, my laptop only has ~4GB of ram, and for the most part it'll only stutter when I open multiple programs or a game, so would zram be adequate in my case?

Also, would the compressing and decompressing have a significant impact on my cpu?

top 3 comments
sorted by: hot top controversial new old
[–] banghida@lemm.ee 9 points 4 months ago
[–] damium@programming.dev 7 points 4 months ago

It can often improve performance and memory latency and usually only has a minor CPU performance impact as it trades cycles waiting for memory for cycles decompressing memory. It is usually decent even on low power embedded devices.

There are a few edge cases where ZRam is not great. If your data is already compressed or encrypted copying it around in memory is much more expensive. It's also harder to tell exactly how much data can be loaded into the "free" memory. It's also a bit slower for serialized memory access in large data sets if the compression ratio is low.

[–] vividspecter@lemm.ee 6 points 4 months ago* (last edited 4 months ago)

Yes, and consider using zstd (if it's not the default on your distribution) and be pretty aggressive with the disk size since it has a high compression ratio. I normally set it to 100% (so zram disk size = physical RAM size), but you can experiment with different values.