I bought an Asus Vivobook Flip 14 2-in-1 laptop last month. It isn’t a speed demon, but with an 8-core Ryzen 7 5700u, 16 GB of RAM, and an NVMe that can push several gigabytes per second, it is definitely not a slow machine.
This is why I was surprised by how slow some parts of my Windows 11 experience have been, but only intermittently. Sometimes I would tap the Windows key to bring up the start menu, and it wouldn’t show up right away. Other times it would show up instantly, but I’d start typing and it would just sit there.
Sometimes it’d let me type enough to see the program I want to run, then I’d hit enter, and it would look as if nothing happened. I can click on the menu item that says open, but nothing opens. Then five or ten seconds later, something happens.
Sometimes I would touch my Wi-Fi or battery icon in the task bar, and it would take several seconds for the quick-settings panel to slide in.
The problem is that this happens at all. This is core functionality that I’d expect would be quite optimized. How does this ever happen on a mid-range computer? The intermittent part has made the problem difficult to solve, but I think I finally have!
I disabled memory compression. How do you do it? Open Powershell with admin privileges and run:
You can turn memory compression back on with this command:
Should you do this? I don’t know for sure, but it can’t hurt to try. Especially if you have plenty of RAM and a good, fast NVMe.
What wasn’t the problem?
I am reasonably certain that this tends to happen most often shortly after waking the laptop up. I am a Linux professional of some sort. At least, I assume I still count as a professional. I am pretty ignorant of precisely what Microsoft has been up to during most of the last decade.
I’m pretty sure sleeping isn’t just sleeping. I’m pretty sure Windows dumps your RAM to storage just in case the battery dies during sleep. I’m pretty sure that when you shut down your computer, that is just a fancy version of hibernation. The trouble is I am only pretty sure about so many things.
The first thing I tried was telling Windows to run the laptop in performance mode instead of power-save mode. Since the problem only happens some of the time, I had to run like this for a couple of days. I thought it was helping, and it might have been helping a bit, but there were still times when I had a lot of latency when I bang on the start menu.
The Asus Vivobook laptop was noticeably warmer. It wasn’t hot, but I could tell it wasn’t cool anymore. Not a huge deal, but heat is a waste of battery, especially since the laptop didn’t really feel any snappier.
Why disable memory compression?
It was hard to get good answers. In fact, I don’t think I got good answers. Intuition says I should give this a try, and it worked.
I don’t know what compression algorithm Microsoft is using, but I hope it is something fast with poor compression ratios. Something like
lz4 decompresses at about 2 GB per second on a fast machine, and I bet it goes even slower on my laptop. Why waste CPU cycles and time compressing RAM when you can swap it to you NVMe just as quickly or even more quickly?
There’s a ton of cargo cult comments around the Internet talking about disabling memory compression and disabling the
SysMain service (formerly
Superfetch). There’s just as much cargo cult around telling people not to disable either one.
They say the current implementation of
Superfetch understands that you have fast SSD or NVMe storage. I have no information about whether or not you should disable it, but I haven’t. It doesn’t seem like something that should be necessary today, but I also haven’t attempted to measure this.
If I understand correctly, my Ryzen 5700u will be stuck at around 2 Ghz for at least several seconds any time the CPU gets hammered. This is a trick that keeps the clock speed from hitting 4 Ghz when something needs to burn a bunch of CPU cycles for half a second.
My guess is that after sleeping, idling, or playing Into the Breach for two hours, the pages of RAM with the start menu and quick-settings panel wind up getting compressed. When my laptop is in power-save mode, it only goes up to 2 Ghz, the RAM takes twice as long to decompress, and that is what I am waiting on. If you’re on a fast desktop computer, or your laptop is plugged in, you are much less likely to even notice this issue.
So far, my guess seems to be correct, because I haven’t seen this latency since disabling memory compression.
I wasn’t just having trouble with my start menu
Steam has been weird. It is already open. I can see it in my taskbar, so I click on it to bring the window into focus. It appears instantly.
Except it may as well be a screenshot. I can’t click anything, and when it does this, it takes way longer than the start menu to start responding.
Someone smarter than me would have opened Task Manager to see what was happening. It never occurred to me. If this were any of my Linux machines, I would have been watching
dstat, and peeking at
dmesg hoping for a hint.
This is a micro optimization solving an extremely specific problem!
I hate latency. I am the sort of person that expects to be able to hit a couple of keys and have a terminal window show up with a ready-to-use shell in less than 200 ms. That was what I expected on a laptop from 2009. We should be doing much better in 2022.
I am sure Microsoft has collected mountains of data about this. I imagine that in most cases, especially with a processor that isn’t trying to sip power, that whatever time we lose waiting for the start menu is made up several times over by the next program loading faster. I am guessing that my situation is an edge case for them, and a bit of delay the first time I hit my start button isn’t a big deal to them.
It is a big deal to me.
I can count three hippopotamuses before Windows 11 can open Windows Terminal and show me my Ubuntu 22.04
zsh prompt. I know there’s an extra layer of virtual machine in there, but my laptop in 2011 could open Gnome Terminal and show me a shell prompt in less than 150 ms.
I don’t know if my reasoning is correct, but the results make me believe my thinking is sound. If you have a slow CPU with a fast NVMe, I bet disabling memory compression on Windows 11 will do you some good. My Ryzen 5700u isn’t exactly slow, but it definitely pretends to be slow when in power-save mode, which is what it should be doing!
What do you think? Are you disabling memory compression? Is disabling compression giving you improvements that you can see? Should I be completely disabling
SysMain? Let me know in the comments, or stop by the *Butter, What?! Discord server to chat with me about it!