A technical blog post by Mozilla engineer Gabriele Svelto explaining Firefox's improved macOS responsiveness through memory allocator optimization. The article engages positively with UDHR Articles 19 (freedom of expression and information), 26 (right to education), and 27 (participation in scientific advancement) through open publication, transparent technical education, and contribution to the scientific commons. Published without barriers and with clear attribution, the content exemplifies institutional commitment to knowledge democratization.
Great to hear that Firefox on macOS might get snappier with these changes. The reliance on undocumented APIs is the only potential red flag.
Out of curiosity, does Chromium use spinlocks on macOS? If they do in a scenario where characteristics need to be similar to the jemalloc use case, how are they accomplishing the outcome?
> If you’re running Firefox on macOS you might have noticed that its responsiveness has improved significantly in version 103, especially if you’ve got a lot of tabs, or when your machine is busy running other applications at the same time.
Huh, now that you say it: I haven't been all that angry at Firefox lately.
Has the battery life issue improved with Firefox at all in the last year or two? I had to choose between degoogled-chromium and Safari because videos drained my battery so fast on my Macbook.
I have been a very happy Firefox user for several years but recently (with 104) I noticed how it uses massive amounts of CPU when being idle. About 60-120% CPU are not uncommon. In the task manager there is no task with heavy CPU load. It seems to get somewhat better over time, but it is really significant, making my Macs quite loud with just an idle Firefox.
The trick to using Firefox on mac like 5 years ago was to use the developer edition. For some reason it was way faster than standard Firefox. I don't know if that's still the case, but I stick to it for good luck.
The go-to synchronization primitive on Windows, critical sections[1], does a short spin in then waits.
To me it has always seemed as a decent strategy, and when working on a cross-platform heavily multi-threaded code base which had a fairly contested hot-spot, Windows performed quite well using just plain critical sections.
you just know someone at apple is having a terrible day now that they realized they'll have to support their weird hack for hybrid spinlocks forever now that firefox adopted it
I have been using FIrefox as my main browser on Mac for a couple of months now (again) and it really does feel like they've done a lot of performance enhancing under the hood.
It's really the only browser left that let's you do deep customization. With the right settings (not that many) you can basically strip it of all bloat. And of course it will be the last (big) browser with full Ubo support when Google introduces Manifest 3 (Ubo was also the reason I switched from Safari to Firefox).
I'm using Firefox on Windows 11 and it's noticeably clunkier than Chrome, especially when using heavy web apps like Jupyter Lab. Oftentimes the browser hangs completely, including all its windows, for 10-30 seconds at a time.
This has been my experience over the years every time I've attempted to switch back from Chrome to Firefox.
Have you looked at `__ulock_wake` versus `os_unfair_lock_with_options`? __ulock_wake is another private darwin API for locking.
From some Zig code:
// Darwin XNU 7195.50.7.100.1 introduced __ulock_wait2 and migrated code paths (notably pthread_cond_t) towards it:
// https://github.com/apple/darwin-xnu/commit/d4061fb0260b3ed486147341b72468f836ed6c8f#diff-08f993cc40af475663274687b7c326cc6c3031e0db3ac8de7b24624610616be6
//
// This XNU version appears to correspond to 11.0.1:
// https://kernelshaman.blogspot.com/2021/01/building-xnu-for-macos-big-sur-1101.html
//
// ulock_wait() uses 32-bit micro-second timeouts where 0 = INFINITE or no-timeout
// ulock_wait2() uses 64-bit nano-second timeouts (with the same convention)
For a while now, performance has not been an issue for me to not use Firefox. It's the no support for the multiline tabs and/or tab groups. Both features which were previously possible in Firefox. This is pretty much a blocker for me and they don't seem to have any plan to fix this.
I’m curious how it was determined that the locking was causing problems? Was it just some intuition from cases with poor performance and staring at code, or some perf-like tool (I don’t really know about the landscape of performance monitoring tools for MacOS) highlighting that a lot of time was spent in locks, or some known MacOS vs others difference?
I think I also don’t understand the discussion about spinning in kernel space. Doesn’t that require context switches which the article points out have issues? I would have guessed the answer would be to spin a bit in userspace with architecture-specific instructions like pause and then syscall if the lock couldn’t be acquired. Maybe I just don’t really know how syscalls work on a Mac.
I’m also weakly curious why jemalloc needs so much locking anyway? I haven’t thought about this at all so I’m surely missing something but my guess would be allocation from per-thread pools with occasional synchronisation, and that this synchronisation would be too infrequent to have these issues.
This blog post has some good discussion about what makes a good locking primitive. On macOS, os_unfair_lock is generally a good choice for many applications. That said,
> At this point, you might wonder if os_unfair_lock – possibly coupled with the undocumented flags – would be a good fit for your codebase. My answer is likely yes but you’ll have to be careful when using it.
I would hesitate to give this advice. The overwhelming majority of applications on macOS do not have performance profiles like Firefox does. The system allocator (rather than jemalloc) is the right choice for all but very few use cases. There are a vanishingly small number of usecases where using the undocumented flags is appropriate.
The rules are different when you’re a popular browser with an existing relationship with Apple and dozens of smart engineers who can (at least in theory) understand the consequences of using this API, and leverage an existing relationship with Apple to ensure that it doesn’t become a liability in the future as the platform evolves. For pretty much everyone else, this should be nothing more than a “wow, neat” blog post.
I've noticed pretty obvious performance improvements in Google Maps recently on macOS (with original M1 chip). Zooming and panning is much more responsive, akin to using Maps on Google Chrome. I wonder if this could have contributed?
I've recently switched from Firefox to Orion.
Ideologically, I'm Firefox all the way - But even in beta, Orion is such a better browser.
* Vertical tabs
* Support for most of the extensions I need
* Much better battery life (at least 1hr+ extra on my 14" M1 Pro MBP)
* Better RAM usage
I get the occasional tab freeze / crash, and it has some glitches with Google Docs / Sheets, but it just feels so much faster and uses much less RAM too
1 happens to me as well. And I even use the Mozilla VPN. I noticed it also happens with Cloudfare's Warp. Turning it on/off or even closing the display while they are active sometimes result in complete loss of connectivity when trying to interact with a tab again.
A lot of times, I have to close the current tab and open a new one to regain connectivity.
It is my only issue with Firefox on mac, currently.
Yeah, video on Firefox is so much worse than any other browser it's insane. Safari still has weird issues with pitch shifting videos playing at over 1x (1, it's an issue with webkit, as it affects Orion as well,) which makes it unviable for me as well. So I'm stuck with... Brave, despite having issues with it too.
> Memory allocators have to be thread safe and – in order to be performant – need to be able to serve a large number of concurrent requests from different threads.
Another approach is to create a bunch of individual allocators that all hold onto a big chunk of memory that only a small set of threads (or even one thread) use. These allocators only contend for locks with each other when they need to fetch more memory from the OS. Otherwise, they just hold onto the big slab of memory they've allocated, give it out when needed, and when it's "deallocated" they keep holding onto it instead of handing it back to the OS, under the expectation that the thread (or small pool of threads) they're managing memory for will need more again soon.
The only downside to this approach is that over time, the app ends up holding onto tons of memory it's not using right now, on the assumption it will be needed in the future.
Ever notice how Chrome eats memory like it's a three-year-old at an ice cream buffet? That performance ain't free.
as someone with many tabs across many windows across many desktops/spaces, one weird trick i found is that when firefox starts up (on an intel MBP, 2019), it will churn CPU at over 100% until you go and foreground each of the windows in each of the workspaces. then the CPU usage becomes normal. perhaps it has to do with extensions like noscript or ublock origin, or my propensity to start firefox without internet access, but i don't think that matters here. not sure why this happens, but it's been required across at least the last few firefox restarts for me.
I'd actually bet nobody at apple cares if they break Firefox users, they don't have the backwards compatibility culture of some companies like microsoft, especially for undocumented apis.
For a few years, DevEdition had multiple content processes enabled (codename "electrolysis", aka e10s), while it was still off in release builds. That made a huge, huge difference to responsiveness and resilience.
I have the VPN problem too. For me, it's a proxy thing. My company puts an HTTP proxy in-place inside of their VPN, and Firefox picks up the settings from MacOS.
When I disconnect from VPN, Firefox still has the VPN's proxy settings. I have to restart it to refresh Firefox's cached proxy settings. So that means I effectively have to restart Firefox any time I change between VPN and non-VPN.
If that's your problem too, then I don't have a fix for it. I'd love to hear if anybody else does though.
Hey, would you mind posting some tips (or an article/link) describing how you stripped the bloat from your Firefox config?
I'm in the same situation as a lot of others here, where I'm thinking about permanently migrating back to Firefox after Chrome takes their Manifest v3 + WebRequest API changes live, and I'd love to know how I can improve the performance of Firefox & ensure my configuration is as good as it can be.
Even if the battery life is not that good as with Safari, there's nothing like Multi-Account Containers extension on other browsers. Helps a lot with separating accounts with added conveniences. Can't really go back to any other browser after having used containers on Firefox!
Post author here, `__ulock_wait2` is used under the hood by `os_unfair_lock()`. I considered it but it would have required more scaffolding, especially to support all the versions of macOS we care about. We might use it in the future though.
I’ve been on brave for about 2 years now and all I see people talk about is Firefox. Should I swap? I thought people liked brave but I really don’t see it mentioned anymore.
My experience is that poor performance esp. memory use is often caused by bugs, and you can't predict the presence of bugs based on whether or not you think a feature is "bloat". Though you can simplify the UI I suppose.
Turning off random browser features only works if you accept that you'll break random websites and won't know why without debugging each one.
Personal experience: Battery drain was always my problem with Firefox on MacOs. Why when using Safari it is nice and full day surfing w/o recharge; but doing the same with Firefox would discharge laptops battery much faster.
It's so clear how Mac OS and Windows both can function without app stores that it's obvious that app stores are a rent-seeking middle men. Terrible that they've been normalized for mobile devices.
I've been shilling for Firefox for years. It is my primary browser for both development and personal use. But I still think it has some catching up to do with Chrome.
I have a web app that allows customers to make templates for their standard operating procedures that they pull from our main product. For writing steps and substeps, I use a WYSIWYG HTML editor called TynyMCE. I went with it because I was able to implement it in an afternoon, their licensing was compatible with our use, and I had a tight deadline.
We failed to anticipate just how large some of the templates clients would be making, so sometimes when they open a template they end up having a couple hundred of these editors hidden behind drag and drop enabled accordions.
Firefox chokes on the initial TinyMCE calls for these large templates, taking quite a long time to fully render the page. Once it's done, everything is nice and snappy, but it's like a 20-30 second wait after the wire even on my beefy 5900x.
Chrome seems to handle this just fine.
It's possible that the culprit is a bad polyfill or a Firefox-specific bug in TinyMCE, I haven't put much work into diagnosing it yet beyond verifying that TinyMCE is eating up all the CPU time. For now my planned solution is to just write my own WYSIWYG editor, because TinyMCE ultimately offers a lot more than we actually need, and it was only a stopgap solution to get out a polished MVP. But needless to say, for the first time in years, I found myself spending a non-trivial amount of development time in Chrome. Sadly I've never actually had a client use this app with anything other than Chrome or Safari, so this is naturally a low-priority issue.
For me, having to log in to multiple AWS accounts, Firefox containers are a killer feature
Editorial Channel
What the content says
+0.40
Article 19Freedom of Expression
High Framing Practice
Editorial
+0.40
SETL
+0.32
Article exemplifies freedom to impart and disseminate information through detailed, transparent technical documentation. Complex engineering concepts are explained clearly and honestly, supporting freedom of expression through knowledge sharing. Implementation details, including undocumented APIs, are documented to advance collective understanding.
FW Ratio: 50%
Observable Facts
Article contains detailed technical explanation of Firefox memory allocator changes published on Mozilla's public blog without access barriers.
Author is clearly identified as Gabriele Svelto with publication date of October 10, 2022.
Content is freely accessible and indexed by search engines with no registration, paywall, or subscription requirement.
Inferences
The open publication of technical implementation details—including undocumented OS APIs—exemplifies freedom to impart information and ideas to the technical community.
The accessible, non-paywalled format supports freedom to seek and receive information about software engineering and performance optimization.
Mozilla's publication demonstrates institutional commitment to transparency and knowledge sharing over proprietary gatekeeping or trade secrecy.
+0.30
Article 26Education
Medium Framing Practice
Editorial
+0.30
SETL
+0.21
Article provides substantive technical education to software developers, explaining complex concepts (memory allocation, thread safety, kernel-space operations, CPU cache mechanics) with progressive clarity. Step-by-step analysis supports critical thinking about engineering tradeoffs and design decisions.
FW Ratio: 50%
Observable Facts
Article explains complex technical concepts progressively: OSSpinLock limitations, os_unfair_lock tradeoffs, kernel-space adaptive spinning, and CPU cache behavior.
Content is published without registration, educational paywall, or technical prerequisite walls, making learning accessible to engineers globally.
Author provides implementation context, caveats, and compatibility challenges, supporting critical analysis of engineering decisions.
Inferences
The accessible technical education contributes to developer learning and professional competency development in systems programming.
Open-access publication of educational content about high-level engineering decisions supports the right to education for technical professionals.
Mozilla's commitment to explaining implementation rationale reflects institutional support for developer education and technical literacy.
+0.30
Article 27Cultural Participation
Medium Framing Practice
Editorial
+0.30
SETL
+0.21
Article documents scientific and technical advancement in memory allocator optimization. Shares methodology, engineering reasoning, performance data, and implementation details with the technical community, enabling participation in scientific progress.
FW Ratio: 50%
Observable Facts
Article documents scientific and technical advances in Firefox memory allocator, including undiscovered kernel-space API capabilities.
Implementation details, performance comparisons, and design rationale are shared publicly for community benefit and replication.
Author discusses testing requirements, compatibility constraints, and known limitations, supporting reproducibility and scientific rigor.
Inferences
Public sharing of technical advances and engineering methodology supports participation in scientific and technical progress.
The open-source model enabling this knowledge sharing contributes to democratized scientific advancement in software engineering.
Mozilla's publication of technical discoveries exemplifies institutional commitment to advancing scientific knowledge as public good rather than proprietary asset.
ND
PreamblePreamble
Preamble affirms equal and inalienable rights and dignity; article does not engage foundational human rights principles.
ND
Article 1Freedom, Equality, Brotherhood
Not addressed in content.
ND
Article 2Non-Discrimination
Not addressed in content.
ND
Article 3Life, Liberty, Security
Not addressed in content.
ND
Article 4No Slavery
Not addressed in content.
ND
Article 5No Torture
Not addressed in content.
ND
Article 6Legal Personhood
Not addressed in content.
ND
Article 7Equality Before Law
Not addressed in content.
ND
Article 8Right to Remedy
Not addressed in content.
ND
Article 9No Arbitrary Detention
Not addressed in content.
ND
Article 10Fair Hearing
Not addressed in content.
ND
Article 11Presumption of Innocence
Not addressed in content.
ND
Article 12Privacy
Not addressed in content; article focuses on technical implementation details rather than privacy principles.
Site implements Google Analytics and GTM tracking with UTM parameter removal utility, indicating awareness of privacy concerns but continued analytics deployment.
Terms of Service
—
Terms of service not observable in provided content.
Identity & Mission
Mission
+0.20
Article 19 Article 27
Mozilla's stated mission around open web and developer empowerment aligns with knowledge-sharing and technical security education.
Editorial Code
+0.05
Article 19
Technical blog format with clear author attribution and date stamps supports editorial transparency.
Ownership
+0.10
Article 19
Mozilla Foundation ownership as non-profit organization supports commitment to public interest over profit-driven content.
Access & Distribution
Access Model
+0.15
Article 26
Open access technical content published without paywall or registration barrier.
Ad/Tracking
-0.10
Article 12
Google Analytics and GTM tracking present on page reduces privacy score despite Mozilla's privacy advocacy.
Content published on open web without paywall, registration, or access restrictions. Clear attribution of authorship and publication date support transparency. Mozilla's non-profit institutional ownership aligns with public interest over profit-driven information gatekeeping.
+0.15
Article 26Education
Medium Framing Practice
Structural
+0.15
Context Modifier
ND
SETL
+0.21
Technical educational content published openly without barriers. Published by established, credible institution (Mozilla) with recognized expertise in software engineering, supporting educational legitimacy and access.
+0.15
Article 27Cultural Participation
Medium Framing Practice
Structural
+0.15
Context Modifier
ND
SETL
+0.21
Technical advances published openly to benefit scientific and open-source communities. Open-source development model enables global participation in scientific advancement. Mozilla stewardship reflects commitment to public scientific benefit.
ND
PreamblePreamble
Not applicable.
ND
Article 1Freedom, Equality, Brotherhood
Not applicable.
ND
Article 2Non-Discrimination
Not applicable.
ND
Article 3Life, Liberty, Security
Not applicable.
ND
Article 4No Slavery
Not applicable.
ND
Article 5No Torture
Not applicable.
ND
Article 6Legal Personhood
Not applicable.
ND
Article 7Equality Before Law
Not applicable.
ND
Article 8Right to Remedy
Not applicable.
ND
Article 9No Arbitrary Detention
Not applicable.
ND
Article 10Fair Hearing
Not applicable.
ND
Article 11Presumption of Innocence
Not applicable.
ND
Article 12Privacy
Not applicable.
ND
Article 13Freedom of Movement
Not applicable.
ND
Article 14Asylum
Not applicable.
ND
Article 15Nationality
Not applicable.
ND
Article 16Marriage & Family
Not applicable.
ND
Article 17Property
Not applicable.
ND
Article 18Freedom of Thought
Not applicable.
ND
Article 20Assembly & Association
Not applicable.
ND
Article 21Political Participation
Not applicable.
ND
Article 22Social Security
Not applicable.
ND
Article 23Work & Equal Pay
Not applicable.
ND
Article 24Rest & Leisure
Not applicable.
ND
Article 25Standard of Living
Not applicable.
ND
Article 28Social & International Order
Not applicable.
ND
Article 29Duties to Community
Not applicable.
ND
Article 30No Destruction of Rights
Not applicable.
Supplementary Signals
How this content communicates, beyond directional lean. Learn more
build aba2bc8+myve · deployed 2026-02-28 16:36 UTC · evaluated 2026-02-28 16:29:11 UTC
Support HN HRCB
Each evaluation uses real API credits. HN HRCB runs on donations — no ads, no paywalls.
If you find it useful, please consider helping keep it running.