Some additional technical notes on KDE's malloc:

Before version 2.3, glibc's malloc implementation guaranteed thread safety
in programs linked with lpthread by using a mutex. This is not a bad idea
in itself. But it is not the fastest way of locking, which you really
notice in applications that use malloc a lot but are not that
multi-threaded themselves (like KDE). Doug Lea wrote a really (really) fast
malloc implementation (1) that was imported as KDE's malloc by Lubos Lunak
(2). They use a spinlock (x86 assembler) as their locking mechanism, which
is a lot faster. There are other performance tweaks in it, but all in all
there exist as many malloc implementations as opinions out there... ;) This
KDE malloc gave a performance gain of about 30% (synthetic benchmark) to
about 10% (real world(TM)), so it really was worth it.
Glibc 2.3 and up use a spinlock for locking and have received some tuning in
their malloc implementation, too (recent glibc's malloc is written by
Wolfram Gloger and is based on Doug Lea's malloc, so it is not that
different from KDE's malloc right now...) (3). So the performance gain of
using KDE's malloc shrinks down to about 5% for glibc 2.3.0 and even less
for recent versions.
In addition to that: we are using NPTL, which should be quite a bit faster
than the old Linux Threads. So although glibc's malloc still has lots of
hooks for heavy multi-threading, it should not hurt as much as it did in
the past performance-wise.
So, to sum it all up: KDE's malloc brought a real performance boost when it
was introduced in 2002, but right now, with glibc 2.3 (or 2.4), kernel 2.6
and NPTL, it does not make THAT much of a difference. And if it poses
problems (like with glib), it becomes a no-brainer. I know you have already
taken it out, this was just a technical comment for some background. ;)

Chris

(1) ftp://gee.cs.oswego.edu/pub/misc/
(2) http://lists.kde.org/?l=kde-core-devel&m=101351949010285&w=2
(3) http://www.malloc.de/en/index.html


-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to