Hasty Briefsbeta

Default musl allocator considered harmful to performance

5 days ago
  • #rust
  • #memory-allocation
  • #performance
  • The default musl allocator causes significant performance slowdowns, up to 7x in real-world benchmarks.
  • Recommendation to replace the default musl allocator with alternatives like mimalloc or jemalloc in Rust projects.
  • Performance issues stem from contention between threads during memory allocation, worsening with more threads or allocations.
  • Musl is still valuable for static executables and cross-compiling, despite allocator performance issues.
  • Benchmarks show musl's allocator can cause up to a 700x slowdown in synthetic workloads on high-core machines.
  • Musl's new mallocng allocator, introduced in v1.2.1, does not resolve the performance issues.
  • Experienced programmers might structure code to minimize allocations, but the default allocator's poor performance can be a significant hurdle.
  • Many projects and reports highlight musl's allocator as a primary source of performance problems.