strdup compared with strlen+malloc+memcpy

Linux

AMD Opteron 285 at 2.6GHz with 1MB L2 cache, gcc3.2.3 (RHEL3 glibc-2.3.2-95.39), -O2


The logfile of the test can be found here.
GNUPlot rc-file: strdup-test.opteron.rc
Remarkable: at a blocksize of 69 bytes, the processingtime suddenly jumps up:
Blocksizewrapperstrdup
6713.89000011.720000
6813.01000011.190000
6918.92000016.460000
7019.73000018.040000
7118.92000016.640000
7217.75000015.350000

Intel P4 at 3.2GHz with 0.5MB L2 Cache (Northwood), gcc3.3.3 Slackware glibc 2.3.3, -O2 -march=pentium4 -fprefetch-loop-arrays


The logfile of the test can be found here.
GNUPlot rc-file: strdup-test.northwood.rc
Remarkable: the first blocks of size 4 or less take less time to copy:
Blocksizewrapperstrdup
210.9700008.460000
311.1900008.330000
414.94000012.050000
514.94000012.090000
Also, at 69 bytes the processing time jumps up:
Blocksizewrapperstrdup
6725.59000017.260000
6825.33000017.070000
6932.34000024.150000
7033.90000023.820000
Again at 256 bytes another jump:
Blocksizewrapperstrdup
25455.47000029.150000
25556.28000028.580000
25662.28000037.820000
25764.28000034.590000

Intel Xeon 2.83GHz 1MB L2 cache gcc 3.2.3 RHEL3-AS (glibc-2.3.2-95.39), -O2


The logfile of the test can be found here.
GNUPlot rc-file: strdup-test.xeon.rc
Notice the peaks every 32 bytes.

Intel P3 (Coppermine) 800MHz 256KB L2 Cache, -O2 -march=i486 Debian libc6-i686 2.3.6-15


The logfile of the test can be found here.
GNUPlot rc-file: strdup-test.coppermine.rc

AMD Sempron, 1.8GHz, 64KB L2, GCC 4.0.3, GLIBC 2.3.6, Ubuntu


The logfile of the test can be found here.
GNUPlot rc-file: strdup-test.sempron.rc

AMD Duron 1.3GHz, 64KB L2, GLIBC 2.3.5, GCC4.0.6, Slackware 10.2, -O2 -march=athlon-4


The logfile of the test can be found here.
GNUPlot rc-file: strdup-test.duron.rc

P2 Klamath, 233MHz, 512KB L2, -O2, GCC4.0.3, glibc2.3.6-15, Debian


The logfile of the test can be found here.
GNUPlot rc-file: strdup-test.klamath.rc

VIA Nehemiah, 1GHz, 64KB L2, GCC4.0.3, libc6-i686 2.3.6-18 Debian, -O2


The logfile of the test can be found here.
GNUPlot rc-file: strdup-test.nehemiah.rc

Other platforms

I added these graphs to see how other libcs behave.

UltraSPARC-IIi 440MHz 2MB L2 Cache sunwspro -O2 (on Solaris 10)


The logfile of the test can be found here.
GNUPlot rc-file: strdup-test.ultrasparc.rc

MIPS running IRIX64 6.5


The logfile of the test can be found here.
GNUPlot rc-file: strdup-test.mips.rc

Celeron 600MHz, Windows XP Professional, Visual Studio 6.0


The logfile of the test can be found here.
GNUPlot rc-file: strdup-test.xppro.rc
Windows XP has no 'getrusage' forcing me to use 'time()', causing the blocky graph.

Celeron III, 800MHz, 256KB L2, GCC3.3, NetBSD 2.1


The logfile of the test can be found here.
GNUPlot rc-file: strdup-test.netbsd.rc

AMD Athlong 1GHz, FreeBSD 5.5 GCC3.4.2-20040728, -O2


The logfile of the test can be found here.
GNUPlot rc-file: strdup-test.freebsd5.5.rc

Celeron 2.4GHz, FreeBSD 6.1 GCC3.4.4-20050518, -O2


The logfile of the test can be found here.
GNUPlot rc-file: strdup-test.freebsd6.1.rc

VAXstation4000/60, 55MHz, 256KB L2, OpenVMS7.2, CCC6.4-005, /OPTIMIZE


The logfile of the test can be found here.
GNUPlot rc-file: strdup-test.vaxopenvms.rc

IBM 7028-6E4, 4CPU @ 1002MHz, AIX5.3 Power4


The logfile of the test can be found here.
GNUPlot rc-file: strdup-test.aix.rc




feedback