Remix.run Logo
▲ Do not buy RAM, compress(curiousbits.nl)
45 points by Ecno92 3 hours ago | 27 comments
▲Lio 33 minutes ago | parent | next [-]

RAM compression sounds very useful but the thing I really need extra RAM for is local inference.

Since the models are effectively highly compressed data already my assumption is that RAM compression won't help improve that much (I'm assuming unified memory here as per the Framework Desktop). A bit like trying to compress a JPEG in a zip file.

Could anyone comment on that?

▲rft 16 minutes ago | parent [-]

I haven't tried it in RAM, but your reasoning matches what I saw when I looked at compressing weights for archiving them. The weights don't compress nicely with standard, especially fast, algorithms. Some more background in this repo [1] including example compression ratios. I would also worry about decompression speed, that gives you a hard bound on the throughput. If the numbers in this repo are accurate, you likely hit the throughput limit of decompression way before you hit the memory limit, even considering the space savings and thus higher effective throughput.

[1] https://github.com/zipnn/zipnn#results

▲jakozaur 11 minutes ago | parent | prev | next [-]

> Memory compression is not new. If you have a Windows or Mac device you are already using it.

Yes, macOS has had it enabled by default since OS X Mavericks 10.9, released in October 2013. I’m surprised some desktop Linux distributions still require manual configuration to enable it.

For browser tabs, though, I think a better solution is automatic tab closing, using something like the Tab Wrangler extension for Chrome. Collecting tabs comes naturally; we’re much worse at closing them.

▲certyfreak 6 minutes ago | parent | prev | next [-]

I switched to Fedora some time ago and only recently learned about zram. I was hitting full system memory(16GB) during normal use, and after increasing my zram to 16GB, I was blown away. I had initially planned to buy additional ram.

▲sammatilda an hour ago | parent | prev | next [-]

I just discovered zram thanks to claude after installing fedora on a new computer and man I was blown away by both zram and fedora. Fedora amongst the linux distributions for some reasons has really got everything that an end user needs and the whole experience is just way smoother than anything I have used in 25 years on linux.

I am hoping to switch my dad from ubuntu to fedora in a month or so because he has 16 GB ram and this seems like something most people dont know.

▲nico 40 minutes ago | parent | next [-]

Wow, very cool. Is this like the old "RAM doubler" for Mac OS (or like Johnny Mnemonic's "Pemex MemDoubler")? :)

▲Lio 36 minutes ago | parent | prev | next [-]

It's funny, I switch from Fedora back to Ubuntu last year.

I really like Fedora in that it seems very up to date package wise but I found it requires a reboot every time I update using the UI updater.

It's better using the dnf command but it still felt a bit lumpy compared to apt.

▲mritzmann 2 minutes ago | parent [-]

Install "needrestart", and you'll see that a reboot would be useful in Ubuntu, too. Many running programs still use the old version of a shared library even after it has been updated. With so many security updates these days, it almost always makes sense to reboot.

▲speed_spread 6 minutes ago | parent | prev [-]

I like Fedora too but I'm pretty sure Ubuntu also has zram. You just need to enable it.

▲roosgit 2 hours ago | parent | prev | next [-]

MacOS has been doing this for quite a while now. I was a bit surprised this wasn’t the default for most Linux distros, although I think Pop!_OS (what a name!) has had zram enabled for a few years already. I turned it on on one of my servers (1GB RAM) and it works fine.

▲kachnuv_ocasek an hour ago | parent [-]

Fedora has had zram on by default for at least five years now.

▲jauntywundrkind 6 minutes ago | parent | prev | next [-]

In many systems, adding compression makes not just storage better but increases the io you get from a system too. Here's Valkey 9.2 compression figures showing that: https://www.phoronix.com/news/Valkey-9.2

That's for RDB persistence. https://valkey.io/topics/persistence/

I wonder if there's any similar wins with ram? That some workloads would see net wins from compression. Some cost of cpu, but increasing net throughput significantly.

▲Ecno92 3 hours ago | parent | prev | next [-]

Since I am using Claude with parallel sessions in different workspaces I started to run out of RAM.

Instead of buying more RAM, which meant that I should replace my device, I decided to implement zram. This compresses memory. Now I can do more with the same hardware.

In many cloud environments compression is not enabled. I am curious to see if the same gains can be made in such environment.

▲XYen0n an hour ago | parent [-]

You can enable it yourself, for example using https://github.com/systemd/zram-generator.

▲ChrisRR 38 minutes ago | parent | prev | next [-]

> Compressing memory does not come with downsides. It takes a little bit more from your CPU and adds latency to some processes

It sounds like those are downsides

▲Rohansi 7 minutes ago | parent | next [-]

It's basically in-memory swap. If you have swap then you already have the added latency (but worse) and I/O usage instead of CPU. Like swap, the downsides only come into play under high memory pressure.

▲xxs 8 minutes ago | parent | prev | next [-]

That's a terrible statement. Perhaps it can apply to certain setups where compression (and decompression) shows decent results, in lots of applications it'd be a massive downgrade.

▲Rohansi 2 minutes ago | parent [-]

zram does not compress all of your RAM. It only compresses inactive blocks of memory that would be eligible for swap, if you had swap enabled.

▲MadameMinty 16 minutes ago | parent | prev [-]

"does not come without downsides" + "does come with downsides" race condition

▲kiicia 10 minutes ago | parent | prev | next [-]

nice try Ram Altman

▲DeathArrow 15 minutes ago | parent | prev | next [-]

I have built my PC with core i7 14700K, RTX 3090,128 GB DDR3, 2TB SSD, 8TB HDD about 3 years ago.

Still perfectly usable and I won't upgrade until prices come down. Even used prices are terrible now.

▲globular-toast 6 minutes ago | parent | next [-]

Mine is an i7 4790K with 32GB of RAM and it's more than usable, I find it quite nippy.

The main thing I regret is not maxing out the memory on my server. At first 32Gi seemed more than I'd ever need, but now it's feeling quite anaemic.

▲theandrewbailey 10 minutes ago | parent | prev [-]

> 128 GB DDR3

Typo DDR5?

▲xxs 7 minutes ago | parent [-]

of course, it supports only that type of memory. 128GB on a desktop 2 ram channel machine is massive, too

▲mzhaase an hour ago | parent | prev | next [-]

Zram vs Zswap: https://chrisdown.name/2026/03/24/zswap-vs-zram-when-to-use-...

> If in doubt, prefer to use zswap. Only use zram if you have a highly specific reason to.

> In terms of architecture:

> zswap sits in front of your disk swap, compresses pages in RAM, and automatically tiers cold data to disk. It integrates directly with the kernel's memory management and distributes pressure gracefully.

> zram is a compressed RAM block device with a hard capacity limit. When you put swap on it and it fills up, there is no automatic eviction, and the kernel has very little leverage to do anything about the situation. The system either OOMs or falls back to lower-priority swap, causing LRU inversion (see below). It only really makes sense for extremely memory-constrained embedded systems, diskless setups, or cases with specific security requirements around keeping private data off persistent storage. Swap on zram is also increasingly unsupported upstream.

▲messe an hour ago | parent | prev | next [-]

Use zswap not zram if you have a backing device:

https://linuxblog.io/zswap-better-than-zram/

https://chrisdown.name/2026/03/24/zswap-vs-zram-when-to-use-...

▲yummybear 30 minutes ago | parent | prev [-]

"Compressing memory does not come with downsides. It takes a little bit more from your CPU and adds latency to some processes"

Which one is it?