This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] benchtests: Add malloc microbenchmark

On 15 April 2014 16:36, Steven Munroe <> wrote:
> On Tue, 2014-04-15 at 14:35 +0100, Will Newton wrote:
>> Add a microbenchmark for measuring malloc and free performance. The
>> benchmark allocates and frees buffers of random sizes in a random
>> order and measures the overall execution time and RSS. Variants of the
>> benchmark are run with 8, 32 and 64 threads to measure the effect of
>> concurrency on allocator performance.
>> The random block sizes used follow an inverse square distribution
>> which is intended to mimic the behaviour of real applications which
>> tend to allocate many more small blocks than large ones.
> This test is more likely to measure the locking overhead of random then
> it is to measure malloc performance.

It uses rand_r so I don't think this is the case.

> Any attempt at defining a new (another) micro-benchmark should profile
> to verify that overhead of setup and measurement is small (< 1%)
> compared to what you are trying measure.

Well there are currently no microbenchmarks for malloc in glibc and
very few in the wild, even fewer with sane licenses.

The benchmark code spends roughly 80% of its time within malloc/free
and friends, which is good, but does leave some room for improvement.
Around 10% of the time is spent in dealing with random number
generation so maybe a simple inline random number generator would
improve things.

> And verify this on multiple platforms.

I work with arm, aarch64 and x86_64 and try and verify as much as
possible across these three architectures, help with others is always

Will Newton
Toolchain Working Group, Linaro

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]