malloc() and spinlocks
Wolfram Gloger
Wolfram.Gloger@dent.med.uni-muenchen.de
Tue Dec 3 08:06:00 GMT 2002
> I don't care what kind of locking will be there, but webcvs still shows no
> change, so the slow mutexes are still used.
Jakub has raised a valid point, namely that the single-threaded case
is slowed down, albeit very slightly in my opinion.
I've measured:
_single-thread_ malloc-test.c, it=30000000 size=1030, Duron 900MHz
Without spinlocks:
avg. 36.5sec
With spinlocks:
avg. 36.9sec
-> i.e. about 1% slowdown
I'm trying to get this down further, but I think the patch could also
be applied as-is, since the gain for multiple threads is so
tremendous. Surprisingly, text size of libc compiled with
malloc-spinlocks went _down_ slightly.
Regards,
Wolfram.
More information about the Libc-alpha
mailing list