r/rust • • Jun 04 '22

Benchmarking Malloc with Doom 3

https://www.forrestthewoods.com/blog/benchmarking-malloc-with-doom3/
97 Upvotes

10 comments sorted by

3

u/eternaloctober Jun 04 '22

great visuals!

3

u/WafflesAreDangerous Jun 05 '22

I'd be curious to see some results with the mesh allocator. Perf would likely be slower.. but it would be interesting to know if it was still usable and managed to have an impact on total memory use.

I'm.. not sure if it runs on non-linux though..

2

u/WrongJudgment6 Jun 04 '22

Curious if it would be possible to use ebpf to get the malloc/free metrics?

0

u/[deleted] Jun 05 '22

[deleted]

1

u/WrongJudgment6 Jun 05 '22

AFAICT you can also create filters to handle malloc/free events like in https://github.com/iovisor/bcc/blob/master/tools/memleak.py I'm also not entirely sure

2

u/abdullak Jun 05 '22

Any chance of adding in tcmalloc and testing multi-threaded allocations?

7

u/KhorneLordOfChaos Jun 05 '22

From the article

Numerous other libraries were considered. Most were excluded because compiling them on Windows required too much effort. I'm looking at you TCMalloc.

3

u/abdullak Jun 05 '22

Ah I must've missed that, thanks!

0

u/[deleted] Jun 04 '22

[deleted]

8

u/Jonhoo Rust for Rustaceans Jun 05 '22

Really interesting article — I love the visualizations! One observation is that you're doing closed loop time workload generation, which tends to lead to super weird artifacts in the produced data. Specifically, it causes tail latencies to look a lot larger than they are, but also makes it seem like there are fewer slow samples than there should be! There's a lot more detail in this paper, but the basic observation is that your measurements get messed up if an allocation takes longer than the time until the next allocation is supposed to happen.

3

u/[deleted] Jun 04 '22

Very interesting, thanks!

Do you - by any chance - have Linux on your machine? I'm wondering if the percentiles are comparable to Windows.