microsoft / microsoft/mimalloc

Why the latest mimalloc performance is seriously reduced.

Open
#633 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I tried based on the following test case (1.c), the latest master version mimalloc, malloc/free performance degradation ; multiple times malloc/free, using mimalloc took 16.5s, surprisingly much slower than the 6.5s without mimalloc.

root@virtual-machine:/media/shixingya/mimalloc/build# vi 1.c
root@virtual-machine:/media/shixingya/mimalloc/build# gcc 1.c -w && ./a.out
6.547415
root@virtual-machine:/media/shixingya/mimalloc/build# env LD_PRELOAD=./libmimalloc.so ./a.out
16.503070

#include <sys/time.h>
int main() {
struct timeval last;
struct timeval next;
gettimeofday(&last, 0);
for (int i = 0; i < 10000000; ++i) {
int *p = malloc(i * sizeof(int));
free(p);
}
gettimeofday(&next, 0);
printf("%llu.%06llu\n",
(next.tv_usec > last.tv_usec ? next.tv_sec - last.tv_sec : next.tv_sec - 1 - last.tv_sec),
(next.tv_usec > last.tv_usec ? next.tv_usec - last.tv_usec : 1000000 + next.tv_usec - last.tv_usec));
return 0;
}

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

Reproduce the timings from the embedded 1.c case using gcc and LD_PRELOAD=./libmimalloc.so, then compare the latest master behavior with and without mimalloc. Trace the allocation path involved in repeated malloc/free calls and identify why the mimalloc run is slower; done means the regression is explained and a focused test or benchmark captures the result.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.