zone-allocator (Was: optimizing & api-doc)

Waldo Bastian kde-optimize@mail.kde.org
Thu, 16 Jan 2003 16:43:42 +0100


On Thursday 16 January 2003 15:53, Lubos Lunak wrote:
> > does kcachegrind do this sort of stuff?, i didn't have time
> > over the last month to use it heavily as i've got no home system :)
> >
> > maybe apple's arena is slightly better than the zoneallocator?
> > can some docs on the usage of the zoneallocator be written?
> > or did i miss a url? ;-)
>
>  Make sure you're using a fast malloc() implementation when playing with
> allocations. The one in current glibc versions is hopelessly slow. I wonder
> if zone allocators really make noticeable difference when having a good
> malloc implementation.

In KDE 2.x (1.x??) times the zone-allocator helped KHTML quite nicely. The 
advantages where:
*) Grouping of related allocations in large blocks: this allows the whole 
block to be returned to the system when no longer needed.
*) Less overhead per allocation. Dunno what the standard overhead is (4? 8? 16 
bytes? But if you have a lot of small stuff (e.g. small strings) you can safe 
a significant amount there. (works actually only for char * strings, since 
everything else usually needs to be aligned)
*) If you are lucky you can skip the free() part and just free the whole block 
at once without bothering to free each object one by one.

Cheers,
Waldo
-- 
bastian@kde.org -=|[ SuSE, The Linux Desktop Experts ]|=- bastian@suse.com