Skip to content

get worse performance after changing from jemalloc to mimalloc #1119

@weixingsun

Description

@weixingsun

Hi,
I have a rust app using jemalloc, when changing to mimalloc , our app get slower:
the rust wrapper: https://github.com/purpleprotocol/mimalloc_rust shows it's backed by version: mimalloc v2.2.4

adding these options as environment variable, but no improvement:
env MIMALLOC_VERBOSE=1 MIMALLOC_SHOW_STATS=1 MIMALLOC_SHOW_ERRORS=1 MIMALLOC_PURGE_DELAY=100 MIMALLOC_USE_NUMA_NODES=1 MIMALLOC_RESERVE_HUGE_OS_PAGES=200 MIMALLOC_EAGER_COMMIT_DELAY=1 ./program

there are some heap info from stderr, I am very new to mimalloc, it seems 0 pages and cached for unknown reason:
Image

Linux kernel: 6.1.119

and the perf trace shows an overhead from mimalloc took pretty much CPU cycles:

Samples: 389K of event 'cycles', Event count (approx.): 6934350124
Overhead  Shared Object       Symbol
  11.83%  program            [.] mi_heap_collect_ex
   8.76%  program            [.] _mi_page_free_collect
   4.76%  libc-2.26.so       [.] __memcpy_avx_unaligned_erms
   4.57%  program            [.] program::test1::benchmark::flush
   3.12%  program            [.] program::test1::lib::custom_map::remove_item
   2.74%  program            [.] _mi_page_malloc

Thanks for advise!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions