5 ms·
It's mainly three things: - ram compression (fast CPU helps that this is non-noticeable) - aggressive swapping on a fast SSD (you'll notice that macOS swaps u
by uniqueuid 5y ago
It's mainly three things:
- ram compression (fast CPU helps that this is non-noticeable)
- aggressive swapping on a fast SSD (you'll notice that macOS swaps unused pages even if there is ram left to make space for file caches)
- the M1 is just very fast, especially ram, so it's snappy overall
- ngngngng 5y agoThe swapping is crazy good, I had an insane memory leak on a process I was running and my swap was up to 60 gigs before I realized what was happening (slight UI stutters at that point) and killed the process.
- uniqueuid 5y agoThe degree to which swapping hurts responsiveness depends a lot on why and how it occurs. If swapping just means moving large contiguous pages that are completely inactive, it's a bunch of writes which neither slows hot memory access nor the ssd. If, on the other hand, you're swapping out pages that frequently need to be re-read, that's another story. So if swapping works well, that's to some degree a sign that your software has bloated "dead" memory regions.
- astrange 5y agoMemory leaks typically don't swap back in, so affect performance less than you'd think. Something like a GC scan can swap them though.
- saagarjha 5y agoWell, it depends on how you're leaking things. If you're doing small allocations and the leaks are interleaved with extant objects, the pages will remain live and you'll just cause pressure.
- Eric_WVGG 5y agoThese are all true, but you’re missing the main one. “Apple Silicon” is very highly optimized for strict reference counting (instead of garbage collection). The retain/release performance is just off-the-wall — even in Rosetta. Details here: https://blog.metaobject.com/2020/11/m1-memory-and-performance.html https://blog.metaobject.com/2020/11/m1-memory-and-performanc... Anecdotally, I spent most of last year in Docker, XCode and Node on an 8gb Air, smoove sailing
- uniqueuid 5y agoThat's true, I forgot that! There's also this informative comment [1] from the post author (Marcel Weiher) explaining some details: "This doesn't use less RAM, it decreases the performance cost of using the more frugal RC." [1] https://news.ycombinator.com/item?id=25208007 https://news.ycombinator.com/item?id=25208007
- CraigJPerry 5y agoNow that’s a piece of the puzzle i hadn’t heard of before. I knew about the memory compression, and iStat menus does a decent job of visualising it but this, this is new to me. HN is such a useful community for finding little tidbits of brain candy like this.
- tempnow987 5y agoInteresting. I don't think retain/release itself is helping with the memory, but reference counting very much seems like it would, and the retain / release speed makes that possible? It's kind of crazy how well 8GB does. On a PC when you have all the pre-installed crapware +++ 8GB is really too low these days.
- disgruntledphd2 5y agoSortof. I personally dislike the way it won't kill ridiculous processes, and "merely" slows everything down massively. To be fair, I'm doing DS on this so end up dealing with really large in-memory datasets, so I hit this relatively often.
- ksec 5y agoI did a few min of Google but couldn't find a source, but I remember Apple had specific instructions and hardware block specific to Memory compression. Making higher and faster compression then previous method relying on solely on CPU.
- saagarjha 5y agoThey do; the instructions implement WKdm in hardware.