Group: comp.lang.c++
From: Juha Nieminen
Date: Sunday, April 06, 2008 1:47 PM
Subject: Re: How to write your own allocator?

I performed some tests about creating memory allocators. It's actually
quite incredible how much, for example, std::list speeds up by using
your own efficient allocator instead of relying on the one in libc.

I actually made a library and a webpage on this subject:

http://warp.povusers.org/FSBAllocator/

For example with std::list, performing the type of test I detail
in that page, the test program sped up from 1 min 12 seconds (using the
gcc's default allocator) to a mere 16 seconds (using my own allocator).
It also probably uses less memory overall (although this is a bit
difficult to measure in linux, but if my measures were correct, using my
own allocator reduced the peak memory usage to almost a half).

It's no wonder C++ may sometimes lose to other languages in speed, at
least if containers such as std::list or std::set are used with the
default allocator. 'new' is a rather slow operation.