microsoft / microsoft/mimalloc
Potential Performance Regression with `dev3`
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 13.4k
- Forks
- 1.2k
- Avg merge
- 4d 45m
- Merged PRs (30d)
- 13
Description
I just did a very quick tests with multithreaded allocation and deallocation. In this the dev3 branch does not perform very well. My CPU is 13th Gen Intel(R) Core(TM) i7-13850HX. The test code is in Rust, I hope this is ok:
# Cargo.toml
[package]
name = "experiment"
edition = "2021"
[dependencies]
rand = "0.9.1"
// main.rs
use rand::{rngs::ThreadRng, Rng};
use std::{hint::black_box, thread, time::Instant};
fn main() {
let start = Instant::now();
thread::scope(|scope| {
for _ in 0..100 {
scope.spawn(|| {
let mut rnd = ThreadRng::default();
for _ in 0..1000000 {
let allocation = vec![0u8; rnd.random_range(1..1000)];
black_box(&allocation);
if rnd.random_bool(0.24) {
allocation.leak();
}
}
});
}
});
let duration = start.elapsed();
println!("took {}", duration.as_secs_f32());
}
My results are (built in --release mode):
❯ LD_PRELOAD=/usr/lib/libjemalloc.so.2 ./experiment
took 0.6000622
❯ LD_PRELOAD=/home/abc/temp/mimalloc/build/libmimalloc.so.1.9 ./experiment
took 0.63197255
❯ LD_PRELOAD=/home/abc/temp/mimalloc/build/libmimalloc.so.2.2 ./experiment
took 0.62372595
❯ LD_PRELOAD=/home/abc/temp/mimalloc/build/libmimalloc.so.3.1 ./experiment
took 4.9627113
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Cargo.toml and main.rs reproducer, then run it in release mode with the listed mimalloc versions and the dev3 branch via LD_PRELOAD. Compare the allocation and deallocation behavior responsible for the 4.96-second result against the faster versions. Done means the regression is explained and a change restores comparable performance under this benchmark.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, rust
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100