microsoft / microsoft/mimalloc

mimalloc overhead vs baseline

Open
#683 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stale
Dominant language
C
Stars
13.4k
Forks
1.2k
Avg merge
4d 45m
Merged PRs (30d)
13

Description

not sure whether you've ever approached benchmarks from this perspective (vs. comparing to other allocators), but i've been benchmarking the convenience of using mimalloc for all allocations vs writing a custom arena or ring allocator for some memory patterns in my network server layer. i can share the code if you like, but below are the results... as just an FYI.

the pattern for each test is preallocate 1GB of memory (so either 1 1GB page, 512 2MB pages, or 262,144 4K pages), MAP_NORESERVE for all, MAP_POPULATE (this brought a huge speed up, but i tried it in mimalloc and saw no difference, weird) with the exception of the overcommitted 4K tests. also tried mimalloc without MAP_UNINITIALIZED and saw a performance cost, but added it to my mmap calls and saw 0 improvement, also weird. then of course the HUGE flags where appropriate. then do 100,000 same sized writes sequentially or randomly.

tests done on a Skylake chip (TLB numbers here https://www.7-cpu.com/cpu/Skylake.html)

IMG_7865

thought this reframing of the performance baseline might inspire some improvements

the conclusion of all this was i decided to just use mimalloc for these per client read/write network streams, than writing something custom myself right now, considering it's already a 32.11x performance improvement over the overcommitted random 4K memory model i had been using.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by reviewing the reported benchmark setup: 1 GB mappings, MAP_NORESERVE, MAP_POPULATE, MAP_UNINITIALIZED, huge pages, and sequential or random writes. Done is not defined until a reproducible benchmark and a concrete allocator improvement are agreed.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
performance
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.