Skip to content

investigate SmpAllocator performance with respect to other popular allocators #12484

Open
@andrewrk

Description

@andrewrk

With #22808 set to auto-merge, I am editing this issue to clarify the issue closure requirements, without changing them.

std.heap.SmpAllocator fills the niche of -OReleaseFast -fno-single-threaded.

Issue Close Requirements:

  • faster than glibc malloc
  • faster than musl malloc
  • (not yet investigated) faster than mingw-w64 malloc
  • (not yet investigated) faster than jemalloc
  • (not yet investigated) faster than mimalloc
  • implement a general purpose correctness test harness for allocators that includes profile-guided fuzzing (see the fuzzing label)
  • introduce an API for default allocator selection

"faster" is vague, and allocators are typically not strictly better or strictly worse than each other. For the purposes of this issue it means the allocator has been tested in various different real world programs and had performance and peak RSS measured, and found to be in the same, or better "sweet spot".

If std.heap.SmpAllocator cannot be adapted to be the winner, or should remain in its own sweet spot while another sweet spot is found to exist, then a new allocator implementation should be created.

A box can still be ticked if due diligence has been done and neither allocator is strictly better than the other, and the set of tradeoffs are judged to be desirable.

Originally, this issue specified that std.heap.GeneralPurposeAllocator should choose this when optimization mode is ReleaseFast, however that has been renamed to std.heap.DebugAllocator. I will open a new issue, or perhaps simply a PR that introduces std.heap.DefaultAllocator that provides reasonable conditional compilation logic for choosing an allocator in an application's main function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    contributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.enhancementSolving this issue will likely involve adding new logic or components to the codebase.optimizationstandard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    Status

    Ditch LLVM

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions