The allocator overloads the global new/delete operators when
'TEST_USE_REGION_ALLOCATOR' is defined. This makes it easier to fit into the
STL. When I run that program with 'TEST_USE_REGION_ALLOCATOR' defined it
get:
Time: 266 ms
The time I get when its not defined is:
Time: 2495 ms
So, this allocator could "possibly" be a definite improvement over original
new/delete operators. There is one MAJOR problem... It's not thread-safe
as-is. However, I don't think its going to be hard to make it work with
threads. I believe I can do a complete non-blocking version. Anyway, before
I go ahead and do that, I was wondering if anybody can give me some
comments/suggestions? BTW, what times do you all get?
Thanks!
--
Chris M. Thomasson
http://appcore.home.comcast.net
An allocator class which could be given to STL containers (as a
template parameter) would be nice.
> BTW, what times do you all get?
When creating my own allocator: http://warp.povusers.org/FSBAllocator/
I made a somewhat comprehensive sanity check test program, which was
also a speed test at the same time.
Here are timing results in my computer (3.4GHz Pentium4) using
gcc 4.1.2 (compilation options -O3 -march=pentium4 -fomit-frame-pointer
-s -DNDEBUG) using that test program of mine:
Default libc allocator: 9 minutes 35 seconds.
My allocator: 1 minute 2 seconds.
Your allocator: 49 seconds.
Agreed.
>> BTW, what times do you all get?
>
> When creating my own allocator: http://warp.povusers.org/FSBAllocator/
> I made a somewhat comprehensive sanity check test program, which was
> also a speed test at the same time.
> Here are timing results in my computer (3.4GHz Pentium4) using
> gcc 4.1.2 (compilation options -O3 -march=pentium4 -fomit-frame-pointer
> -s -DNDEBUG) using that test program of mine:
>
> Default libc allocator: 9 minutes 35 seconds.
> My allocator: 1 minute 2 seconds.
> Your allocator: 49 seconds.
Weird. I would have thought that a fixed-block allocator would totally beat
my general-purpose allocator.
Yeah, I don't know what the bottleneck is. Trying to profile the code
is basically impossible because all the functions are inlined (the
profiler only sees main(), and that's it), so I'm at a loss.
(I don't think disabling optimizations would be a good way to profile
the code to find the bottleneck because turning off optimizations may
well create bottlenecks which are inexistent in the optimized version.)