This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
strdup versus strlen/malloc/memcpy
- From: Folkert van Heusden <folkert at vanheusden dot com>
- To: libc-alpha at sources dot redhat dot com
- Date: Wed, 9 Aug 2006 12:07:50 +0200
- Subject: strdup versus strlen/malloc/memcpy
- Reply-by: Tue Aug 8 18:58:10 CEST 2006
Hi,
While doing optimalisations to some software I wrote I noticed that my
own strdup implementation is much slower then the standard strdup
implementation. This is strange as my own implementation is exactly the
same as the glibc one. What is even more strange is that the difference
in speed is NOT CONSTANT: the larger the string, the bigger the
difference in executiontime.
Now I'm not asking you to debug my code (quiet a
few eyeballs went over it already). I'm just wondering what might
causing this difference. Especially I'm wondering if maybe something is
wrong with the strlen or malloc or mempcpy implementation when called
from your own code.
In case anyone would like to check what I did: the code, logfiles and
some gnuplot graphs can be found at:
http://www.vanheusden.com/misc/strdup/
Folkert van Heusden
www.vanheusden.com/multitail - multitail is tail on steroids. multiple
windows, filtering, coloring, anything you can think of
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com