I have to wonder if the better solution would be for browsers (and apps that are effectively broswers) to compress their data proactively.<p>I find that the ratio of browserish memory use to that of other programs is enough to render the latter insignificant most of the time.
Compression is fine as long as the CPU doesn't become the bottleneck.
RAM compression sounds very useful but the thing I really need extra RAM for is local inference.<p>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.<p>Could anyone comment on that?
it interesting because usually on workstation the browser & electron apps it's that holding much of the memory hostage (it's very common to see that browser consuming 20-30gb on 64gb system), so may be if it will be significant compression win on that side it leads to more memory for model but how much performance penalty would be for inference in that case?
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.<p>[1] <a href="https://github.com/zipnn/zipnn#results" rel="nofollow">https://github.com/zipnn/zipnn#results</a>
> A bit like trying to compress a JPEG in a zip file<p>Interesting comparison, I wonder if there are loss-less compression schemes that are "weight-aware", about the statistical properties of model weights.<p>Back to that line - because (Huffman coded) JPEG images can be lossless recoded using arithmetic coding, which makes them smaller than if they were compressed with the best general-purpose compression algorithms/tools (e.g. `jpegtran -arithmetic < input.jpg > output.jpg` beats `xz -9 < input.jpg > output.jpg`). AC takes advantage of the properties of the image coding better than general-purpose compression tools on the output of the Huffman coding.
The library I use for archiving compressed raw LLM weights ([1] , posted in my other comment) afaik at least reorders the weights to more easily compress them. They also have a paper linked, which I admittedly didn't read, that might have more background and tradeoffs. Likely they will have discussed methods to take advantage of the structure of weights.<p>[1] <a href="https://github.com/zipnn/zipnn#results" rel="nofollow">https://github.com/zipnn/zipnn#results</a>
I don't know at all. But I've been playing with oMlx and Splash. Using Pi there are compression extensions like the billion-context. I suspect your right.<p>But all seem to have massive issue boards. What I did see was oMlx release clustering so you can string 3 macs and have 3 times the memory or use one for prefilling accelerating.<p>Which I thought was neat and what I'll likely poke at instead of getting more ran.
What a fun loop through time. I remember downloading programs to free up ram in the early 2000's, then as RAM became more ubiqutous and programs were still small you could run them directly on RAMDisk. (I did this with Path of Exile about 10 years ago to avoid lag.) Now we are working back to getting the most out of our ram.
> Memory compression is not new. If you have a Windows or Mac device you are already using it.<p>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.<p>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.
Chrome has had a built-in tab-sleeping Memory Saver feature for 4 years: <a href="https://blog.google/products-and-platforms/products/chrome/new-chrome-features-to-save-battery-and-make-browsing-smoother/" rel="nofollow">https://blog.google/products-and-platforms/products/chrome/n...</a>
Wait, Edge on windows automatically puts tabs to sleep when they are unused (<a href="https://explore.microsoft.com/en-us/edge/features/sleeping-tabs?form=MT0160" rel="nofollow">https://explore.microsoft.com/en-us/edge/features/sleeping-t...</a>). I think edge weren't even the first one, thus being kinda surprised I see chrome needs extension for that?
For Chrome I recommend The Marvellous Suspender, which can auto-suspend unused tabs. Has been a life-saver for me for quite a while.
>I’m surprised some desktop Linux distributions still require manual configuration to enable it.<p>Its a user choice and should be a user-facing knob because there are times it is inappropriate for use, such as in safety-critical circumstances, certain realtime realities, and so on. It should probably be on by default for desktop Linux, but off by default for every other application a distribution may be targeting ...
Vectors do not compress.
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.<p>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.
Wow, very cool. Is this like the old "RAM doubler" for Mac OS (or like Johnny Mnemonic's "Pemex MemDoubler")? :)
It's funny, I switch from Fedora back to Ubuntu last year.<p>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.<p>It's better using the dnf command but it still felt a bit lumpy compared to apt.
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.
Could this be one of the tricks the M-series cpus are pulling behind the scenes to make them look faster?
I like Fedora too but I'm pretty sure Ubuntu also has zram. You just need to enable it.
For a programmer, on many cases, it pays to compress the data, to improve RAM IO, because the alu may already be doing nothing meanwhile waiting for the data from ram, so you can use that time to decompress, process, compress, and store the result. A lot of code today is bottlenecked by IO. You spend a lot of effort optimizing with SIMD, processing the data super fast, and then the speed it's wssted because there is not enough bandwidth to even send the result to ram. Modern cpu should include more hardware support for memory compression
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.
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.
Don't use Zram, use Zswap. Especially if you want to swap to disk.<p><a href="https://chrisdown.name/2026/03/24/zswap-vs-zram-when-to-use-what.html" rel="nofollow">https://chrisdown.name/2026/03/24/zswap-vs-zram-when-to-use-...</a>
Things I did:
- Zswap instead of zram.
- Unload browser tabs (my own private extension.
- Force idle cli AI agents to go to disk swap earlier.
So, if it is used as swap, that means to use the data, it first needs to go to the CPU, then back to regular RAM, then back to the CPU.<p>Isn't that wasteful? The CPU's caches may help a bit, but I would guess first a huge block is going through the decompression, so only the last bits are still in the cache, when the actual usage starts.
I've used zswap on most of my systems and generally find it beneficial especially as (de)compression can be very fast these days.<p>What's interesting to note is that I've occasionally wondered why isn't the swap partition compressed.<p>If you have it on an NVMe drive it probably is as is all data! The controller usually transparently does it as it writes to/from NAND.<p>So the kernel sees uncompressed fixed block pages and the speed boosts happen with data arriving faster when read or written to flash.
> I've used zswap on most of my systems and generally find it beneficial<p>I started using zswap recently but didn't have the time yet to benchmark and measure the benefit. Does it benefit machines with low amounts of RAM like 1GB (small headless servers) or better not bother?<p>> If you have it on an NVMe drive it probably is as is all data!<p>In the consumer SSD space the last controllers I know to do on the fly compression were SandForce [1], probably 15 years ago, when minimizing writes and saving the little capacity available was imperative. I don't think any other desktop SSDs do this now. A bit more common in enterprise models like ScaleFlux CSD.<p>[1] <a href="https://en.wikipedia.org/wiki/SandForce#Products" rel="nofollow">https://en.wikipedia.org/wiki/SandForce#Products</a>
You’d hope with these amazing GPUs today, that some cycles can be used to compress RAM very efficiently. So many parallel cores, surely we can get even better compression from this latent hardware?
Having viewed that page, I cannot fathom how Firefox is using 27GB of RAM in his screenshot?!
> Compressing memory does not come with downsides. It takes a little bit more from your CPU and adds latency to some processes<p>It sounds like those are downsides
I believe I have written this not in the best way. (I have uploaded a slightly improved version)<p>I did not really notice a large performance impact.<p>Unless you are in an environment where compute performance is critical, I think this is something interesting to try.
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.
They are downsides in cases where an application has to escalate a critical fault as quickly as possible - indeed where every nanosecond counts - and a process waiting for page restoration is going to be delayed even an intolerable amount.<p>It should be a user switch and probably will become one in most Linux desktop distributations, I would wager. However, I would not enable it - I run Ubuntu Studio for every last little bit of latency it gives me in a realtime audio-capture application, and on those systems were it to become default-on by way of distro update, I'd be kinda miffed.
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.
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.
The distinction is in the distribution - is the Linux bootable for an end user or is it for a rack-mount industrial application - since anyway the kernel configuration has to be involved to have zswap effectively applied at kernel runtime.
They are not selling it well.<p>It’s like saying that in order to breathe you have to use your nose or mouth. Which is bad if you want to retain the oxygen that is inside your lungs.<p>There are always scenario’s where memory compression is an outright bad idea. Just like trying to breathe under water.
"does not come without downsides" + "does come with downsides" race condition
What's old is new again!
<a href="https://apple.fandom.com/wiki/RAM_Doubler" rel="nofollow">https://apple.fandom.com/wiki/RAM_Doubler</a>
nice try Ram Altman
Since I am using Claude with parallel sessions in different workspaces I started to run out of RAM.<p>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.<p>In many cloud environments compression is not enabled. I am curious to see if the same gains can be made in such environment.
"Compressing memory does not come with downsides. It takes a little bit more from your CPU and adds latency to some processes"<p>Which one is it?
Windows doesn't do memory compression if the page file is not enabled. I never particularly saw the point of the page file because I don't enjoy swapping, but it appears that the memory management system disproportionately depends on it to the point where it simply refuses to work properly with it off. So make sure that's turned on if you want memory compression. (Do not let it auto-size or it will happily fill up your whole drive, set it to something reasonable)
So why is zswap (basically zram+swap) not enabled by default everywhere?
Because it is a user choice, and there are applications where it is inappropriate. For desktop Linux it should probably be on, as long as its clear to the user - but yeah, for many other Linux use cases its inappropriate.
> If you have a Windows or Mac device you are already using it<p>Technically yes, practically on Windows memory compression is not used.<p>I have Windows 11, 128 GB RAM, and my memory stats show: 42 GB in use, 380 MB compressed.
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: <a href="https://www.phoronix.com/news/Valkey-9.2" rel="nofollow">https://www.phoronix.com/news/Valkey-9.2</a><p>That's for RDB persistence. <a href="https://valkey.io/topics/persistence/" rel="nofollow">https://valkey.io/topics/persistence/</a><p>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.
Okay, Johnny Mnemonic.
Zram vs Zswap: <a href="https://chrisdown.name/2026/03/24/zswap-vs-zram-when-to-use-what.html" rel="nofollow">https://chrisdown.name/2026/03/24/zswap-vs-zram-when-to-use-...</a><p>> If in doubt, prefer to use zswap. Only use zram if you have a highly specific reason to.<p>> In terms of architecture:<p>> 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.<p>> 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.
I enjoyed that Zram article a lot way back when.<p>( <a href="https://news.ycombinator.com/item?id=47500746">https://news.ycombinator.com/item?id=47500746</a> )<p>It’s long and more satisfying than this In These AI Times wrapper.
What if I loathe swap? The I/O hit of hitting swap, even with SSD, always mean a severely degraded desktop experience. I often end up closing applications to free up RAM or would just order more RAM back when it didn't involve taking a third mortgage.<p>I would rather have the system tell me there's not enough memory than try to pretend there's an infinite amount of it and then slow to a crawl without apparent reason. Unix memory allocation is daft. Desktop swap to block never worked, never will.
[flagged]
[dead]
Use zswap not zram if you have a backing device:<p><a href="https://linuxblog.io/zswap-better-than-zram/" rel="nofollow">https://linuxblog.io/zswap-better-than-zram/</a><p><a href="https://chrisdown.name/2026/03/24/zswap-vs-zram-when-to-use-what.html" rel="nofollow">https://chrisdown.name/2026/03/24/zswap-vs-zram-when-to-use-...</a>
I have built my PC with core i7 14700K, RTX 3090,128 GB DDR3, 2TB SSD, 8TB HDD about 3 years ago.<p>Still perfectly usable and I won't upgrade until prices come down. Even used prices are terrible now.
Mine is an i7 4790K with 32GB of RAM and it's more than usable, I find it quite nippy.<p>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.
> 128 GB DDR3<p>Typo DDR5?
Yes, it was a typo, I use DDR4.
of course, it supports only that type of memory. 128GB on a desktop 2 ram channel machine is massive, too