10 ms·
I don’t understand the magic at work in an 8gb M1 macbook air. If i run android emulator (consuming 4-6Gb) + iPhone simulator (1-2Gb) + react native hot reload
by CraigJPerry 5y ago
I don’t understand the magic at work in an 8gb M1 macbook air.
If i run android emulator (consuming 4-6Gb) + iPhone simulator (1-2Gb) + react native hot reload toolchain (1-4gb) + vscode (1-2gb) + firefox (1-3gb) all concurrently, then my memory pressure is around 65%, i have about 3gb swapped but very little paging activity.
Everything feels snappy.
What is this magic? I was convinced it would be the speedy SSD masking the page faults but there’s very little swapping going on.
Quite taken with it tbh. Still think MacOS is crap overall though. Soon as linux is viable on M1 as a daily driver, i am checking out of macos.
- uniqueuid 5y agoIt'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.
- inglor_cz 5y agoPossibly they improved caching algorithms? Cache misses are expensive.
- deleted 5y ago[deleted]
- marricks 5y agoMaybe a lot of user issues regarding lag wasn't GB of memory which everyone made it out to be but really slow OS and Intel chips getting progressively slower all those security patches...
- draw_down 5y ago
- kitsunesoba 5y agoI wonder if CPU architecture differences have any perceptible impact on user experience. It may be my imagination but back during the PowerPC → Intel transition it felt like the two CPU archs had different "responsiveness profiles" with the OS stalling or feeling bogged down at differing times/situations.
- mcphage 5y agoI know OS X has had a feature for compressing data in RAM on the fly—the processor is much faster than RAM, so compressing & uncompressing & loading a smaller amount of data was faster than just loading the larger amount of uncompressed data. That might be what you're seeing.
- michaelcampbell 5y agoI'm keeping an eye on Asahi Linux for M[12]. Other than the CPU, I don't much care for the entirety of the Apple experience, but that's me. This M1's absolute silence with all the cores running and its battery life are wonderful.
- moonchrome 5y agoWhat makes you think a reverse engineered driver set, with no official docs, on a custom and closed platform - is going to offer anything close to M1 MacOS experience ? If you want a quiet device with low battery consumption and don't care about performance you can downclock/disable turbo boost and get that on other devices, with better Linux support.
- philistine 5y agoIs there a Linux laptop like that without a fan at all like the M1 Macbook Air?
- floatboth 5y agoIf you're fine with the performance of a 2-core Kaby Lake and rather big bezels around the display, the Google Pixelbook is pretty awesome otherwise.
- lillecarl 5y agoProbably with a performance penalty in comparison to the M1 though, and the Apple chassis quality/design is something else, you just don't get it elsewhere. Considering what the Asahi team has been doing so far and their reports I'm positive the CPU isn't a problem (since it's ARM). If they can get decent GPU performance (power consumption mostly) I'll be all over them.
- elzbardico 5y agoI wonder if we 3-D scanned a PC laptop chassis and then machined a copy from an aluminum block using a CNC would give us a macbook-like chassis for a PC.
- justinsaccount 5y agoOS X does memory compression. A few years ago I was trying to reproduce a memory issue in a C++ app by sending it a ton of the same thing over and over again.. on my OS X laptop I couldn't reproduce the problem at all, until I had it send random data. If you open "Activity Monitor" and look at the memory tab, it will show you a value for "Compressed" see https://appleinsider.com/articles/13/06/13/compressed-memory-in-os-x-109-mavericks-aims-to-free-ram-extend-battery-life https://appleinsider.com/articles/13/06/13/compressed-memory... or similar for more info.
- favorited 5y agoWhich is why, as an iOS developer, you should never respond to memory pressure notifications by actively freeing memory! You'll inevitably end up touching compressed memory pages in the process, increasing your app's memory use as pages get decompressed so you can free the allocations. [this is technically true on the Mac, but your Mac app isn't going to get jetsam'd like your iOS app will]
- slimsag 5y agoWould this be the case if you just used the `free(3)` syscall, and didn't otherwise touch the memory? I can imagine destructors in most languages involving touching the memory, just curious if a free syscall alone does it or not.
- MisterTea 5y ago> Quite taken with it tbh. Still think MacOS is crap overall though. So the amazing memory management you love so much is likely part of the crap os you don't. > Soon as linux is viable on M1 as a daily driver, i am checking out of macos. Might as well check out of the apple ecosystem and save yourself some money while you're at it. AMD is supposedly releasing an Arm SoC and theyre also working on one with Samsung (likely mobile). Whether either of them are Laptop/desktop ready or comparable to the M1 is unknown (unlikely competitive without a comparable software ecosystem).
- john_alan 5y ago“Crap” I daily drive 3 Linux devices and 2 macOS. macOS isn’t close to crap. It’s better than Linux in some contexts and worse in others. Overall about par.
- _hl_ 5y agoBut that's just, like, your opinion, man. I think Windows is crap and yet it has billions (!) of users.
- lillecarl 5y agoI'd argue that's because your use-case doesn't match that of billions of users. Microsoft has to make judgment calls based on user experience of billions of end users on both kernel and front-end parts whereas the the Linux kernel developers can care only about the power users, which makes for a great kernel with superpowers, but you also need superpowers to wield it. Yes desktop Linux is probably better these days for casual users of many degrees, but those users should probably be using ChromeOS (disregarding privacy questions, only UX) whereas the Linux desktop gives you the choices of boatloads of desktop environments and configurability. There's a reason Windows is the most used "computer operating system" (disregard android and ios). I'm very happy on Linux myself just to be clear, but there are reasons why we're just a few percent of the market, and using free as in Libre and gratis software mostly.
- dasloop 5y agoWindows is crap, Linux is crap, macOS is crap... the crap frat in action. Maybe I'm too pragmatic, maybe OSs are difficult and engineers working on them deserve some credit. Maybe...
- Rexxar 5y agoCalling something crap doesn't give any meaningful information. Tell what are the use case where it doesn't work correctly for you.
- mastazi 5y agoI agree, even the GPU is impressive and I say that as someone whose main computer is a gaming PC with an RTX2080. But the mind-blowing part is the CPU where on some tasks I can get desktop-i9-like level of performance.
- amelius 5y agoApple must explain what it is doing here, otherwise high performance programming becomes like a cargo cult.
- pwinnski 5y agoThey have explained, in some detail. Most of the explanation has already floated up above this comment.
- pdpi 5y ago> Still think MacOS is crap overall though. Soon as linux is viable on M1 as a daily driver, i am checking out of macos. This is a weird position to hold. You just argued why macOS does some fundamental things (at least memory management) really well.
- andrekandre 5y agojust a guess, but probably they are saying from a developer perspective; there are less options in macos (many libraries/packages not available) and less room to customize things
- drewzero1 5y agoIt's possible to appreciate certain aspects of a product and still dislike the product as a whole. I appreciate how relatively easy it is to understand Windows' directory structure (for example) but that doesn't mean I want to use the whole OS on my own time.
- rightbyte 5y agoYe, I dislike the Unixy way of mounting hard drives where ever. There is some mental calmness of having the root of the HD at a drive letter in "My Computer" ...
- TimeBearingDown 5y agoLinux disk management tools were my gateway drug. diskpart and diskmgmt.msc are fine, but gparted does nearly anything feasible, it’s indispensable. Then you just run ‘mount’ and ‘df -h’ a lot and in the end that’s similar to ‘net use’ on Windows + My Computer wrapped into one. “Everything is a file” is a useful paradigm, and then just think of your disk as an image file in a fixed spot. Sorry if this winds up a ramble or you’re well aware.
- pdpi 5y agoSure, but there is a difference between "I don't like this" and "this is crap". I can 100% see how macOS might rub people the wrong way, and there are definitely some dubious choices in there from a purely technical point of view, but that doesn't really amount to "crap overall".
- zitterbewegung 5y agoHopefully Linux on the M1 won’t introduce big issues. I remember daily driving a MacBook Pro 2014 or so and it was pretty horrible .
- deeg 5y agoI have Ubuntu on a ~2017 MBP and except for the camera it works great. I had to fiddle with a few settings for quite a while to get sleep mode working well but other than that no problems. If I could get an M1 working as well with Ubuntu I'd switch in a second (currently on a Thinkpad).
- fredwu 5y agoInteresting. I had the opposite experience. I had a 16GB M1, and once the RAM is exhausted it grinds to a halt - everything lags, including simple tasks like switching browser tabs, every now and then the spinning beach ball of death would come on. It was the worst experience I've had in a modern laptop. Now I'm on a 64GB M1 Max and things are super snappy again. (Monterey on the other hand is buggy as hell, simple things like tap to click and pinch to zoom are broken. [1]) [1] https://forums.macrumors.com/threads/tap-to-click-issues-on-b9-and-10-and-now-monterey-release.2317279/ https://forums.macrumors.com/threads/tap-to-click-issues-on-...
- nostromo 5y agoTry using Safari instead of Chrome. Chrome on M1 is a lackluster experience. Safari is amazingly fast, even with a hundred open tabs. You can tell Apple has been optimizing a web browser on their own silicon for a long time.
- fredwu 5y agoI use Firefox as my main browser, and Brave as my secondary. Safari might be blazingly fast but unfortunately I rely on a lot of extensions that don't exist on Safari. And I rely on Firefox's containers too. :)
- sys_64738 5y agoThese trackpad issues were fixed a long time ago.
- fredwu 5y agoNo it hasn't. If you read the latest relies (including mine) in the thread, you'll notice that CMD/SHIFT + tap is still broken, at least on the 14". I'm on the latest 12.3 beta too.
- deleted 5y ago[deleted]
- herpderperator 5y agoI went from a 64GB RAM ThinkPad to a 8GB RAM M1 Air, and ditched my PC entirely. No fans, no noise, no heat, it's like a fairytale. Watching videos in 4k60 has very low CPU usage if any thanks to excellent hardware acceleration with modern browsers (especially Safari for obvious reasons). Many things to be impressed about.
- hughrr 5y agoThis. I am considering buying a 24” iMac now as well.
- snvzz 5y ago>Watching videos in 4k60 has very low CPU usage if any thanks to excellent hardware acceleration with modern browsers This is in no way exclusive to Apple.
- herpderperator 5y agoIf you know of a laptop that runs Linux which isn't ChromeOS that can YouTube at 4k60 without its fans ramping up at all or being audible, I'd love to hear it. My experience has not been such.
- snvzz 5y agothinkpad x395 (2019), the one I am using. I suspect your setup isn't using hw acceleration for video decode.
- 1-6 5y agoCorrect me if I’m wrong but the M1 performs and looks better on paper when doing synthetic benchmarks because they’re heavily optimized for specific tasks with ASICs on the SoC. While commendable to the general public, once a new video codec that’s NOT H264/H265 comes out, it’ll probably rely on general purpose cores and may fall behind dedicated GPUs which have slightly more capability than ASICs for general use. Fortunately, H264/H265 isn’t going anywhere so that MacBook will continue to efficiently process 4K60 videos on little power.
- birdyrooster 5y ago
- firecall 5y ago> Still think MacOS is crap overall though And you were doing so well! ;-) WRT M1 hardware, thats my experience too! I picked up an M1 Mac mini 8/256 on the Apple Refurb Store as a stop gap machine whilst I waited for the Pro laptops. I ended up waiting a long time! But it was amazing. The 256GB drive was a bit tight, and fills up a little too quickly. But overall, it was the best computer I'd ever owned! In the early days I had USB related kernel panics, but later macOS updates seemed to fix all that! I replaced it with a 16" M1 Pro 16/1TB, and the Mac mini is now working out it's (hopefully) long life in my server cabinet!
- rubyist5eva 5y agoOS X has insane memory management. One time I had a runaway process using 120gb of swap and never even noticed until I opened Activity Monitor to do look at something something unrelated.
- canadianfella 5y ago