[Gentoo] Tracking down crappy performance

Remember a while back when I posted a review of a great book on performance optimization? I just found a USENIX paper by the same guy talking about how he tracked down a performance problem to discover that glibc’s malloc() implementation is optimized for system-wide memory efficiency, not performance, and how to change that.

It’s very easy going, suitable for someone with some slight knowledge of C. Recommended reading.

Update: The paper is from 2001, and I haven’t personally verified that this is still the case but it really wouldn’t surprise me at all. glibc’s behavior is definitely still the same (see the malloc() info page), but perhaps mmap() no longer results in a minor page fault. But the really interesting part of the paper to me is the process of tracking down the problem.

Update 2: Val Henson and Arjan van de Ven have written a patch to change this behavior. Here’s her patch page. I coincidentally found this out because Val’s speaking at our LUG meeting tonight.