Don't use musl if you care about performance

Hacker News Top News

Summary

This article benchmarks musl's performance against glibc, revealing that musl's memory allocator is suboptimal and even with mimalloc, it remains significantly slower. It advises against using musl for performance-sensitive applications.

No content available
Original Article
View Cached Full Text

Cached at: 08/28/26, 06:30 PM

# Don't use musl if you care about performance Source: [https://blog.brokk.ai/dont-use-musl-if-you-care-about-performance/](https://blog.brokk.ai/dont-use-musl-if-you-care-about-performance/) By[Jonathan Ellis](https://blog.brokk.ai/author/jonathan/)—27 Aug 2026![Don't use musl if you care about performance](https://storage.ghost.io/c/f5/e4/f5e49182-2f16-4855-8727-fde7524e784f/content/images/size/w1200/2026/08/f8dd5d3e-f924-4fcb-b4d5-840569aa6bf3.png)I've spent most of my career working inside the JVM, with a sidebar of Python\. So the first time I hit incompatible libc with containerized[Bifrost](https://github.com/BrokkAi/bifrost/?ref=blog.brokk.ai), and GPT suggested musl as the solution, not only did I jump on it, I moved my other Rust projects to musl as well\. Self contained binaries with a single implementation backing them? Yes, please\! Then my colleague Ryan mentioned that musl is known to have a suboptimal allocator, and pointed me to[Daniel Raneland's article](https://raniz.se/blog/2025/rust-musl-malloc?ref=blog.brokk.ai)\. Uh\-oh\. I decided to measure it to see how bad it was\. ![](https://storage.ghost.io/c/f5/e4/f5e49182-2f16-4855-8727-fde7524e784f/content/images/2026/08/bifrost-libc-total-runtime.png)So, yes: musl's allocator is indeed bad\. Terrible, even\. And \(contrary to some of the articles I've read\) not only in high concurrency scenarios; these numbers are from 4 core EC2 VMs, and Bifrost sizes its thread pools accordingly\. This is a really bad footgun to leave loaded for users and honestly, I think musl should ship without an allocator and make you choose one\. Then if you choose the really bad one for some reason \(maybe the code footprint is really tiny? idk\) then that's on you, instead of "oh sorry did you not read the fine print? lol wasn't that a fun surprise\!" But unfortunately "just use mimalloc" \[or jemalloc\] is not a magic wand that gets musl performance parity with glibc; musl with mimalloc is still 26% slower\. So I dug deeper into the two task types that showed the worst regressions\. ![](https://storage.ghost.io/c/f5/e4/f5e49182-2f16-4855-8727-fde7524e784f/content/images/2026/08/bifrost-libc-mimalloc-mechanism.png)`scan\_usages`does get some benefit from mimalloc, but remains slower than on glibc\.`structural\_clone\_smells`on the other hand barely allocates; the difference on musl with and without mimalloc is noise\. Yet`s\_c\_s`suffers even more, proportionally, from musl than does`scan\_usages`\. It turns out that the allocator isn't the only suboptimal code in musl, and several common memory routines are particularly slow: ![](https://storage.ghost.io/c/f5/e4/f5e49182-2f16-4855-8727-fde7524e784f/content/images/2026/08/bifrost-libc-memory-primitive-breakdown.png)## Simplicity still isn't free I'm going to keep smaller projects where 25% slower doesn't matter \(like[Hel](https://github.com/brokkAi/hel?ref=blog.brokk.ai)\) musl\-only for simplicity—with the addition of mimalloc\. But in the spirit of not leaving more loaded footguns around, we're removing musl as an prebuilt option from the much\-more\-performance\-sensitive Bifrost\.

Similar Articles

mimalloc: A new, high-performance, scalable memory allocator for the modern era

Lobsters Hottest

mimalloc is an open-source, high-performance, scalable memory allocator that serves as a drop-in replacement for malloc and free. Designed for modern highly concurrent applications and large memory scales, it is used in major services like Bing and integrated into projects such as NoGIL CPython and Unreal Engine.

Benchmarking Wild vs Mold

Lobsters Hottest

The article investigates discrepancies in benchmark results between Wild and Mold linkers, analyzing how configurations like file systems and fork settings impact performance.

Leaving performance on the table

Lobsters Hottest

A technical blog post demonstrating how Profile-Guided Optimization (PGO) with LLVM can significantly improve binary performance beyond standard -O3 and LTO, using SQLite as a benchmark.

Mutex poisoning is not for everyone

Lobsters Hottest

A blog post arguing that mutex poisoning by default is one of Rust's biggest design mistakes, harming performance and readability while failing to solve the general problem it targets.