This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
RE: [PATCH] Improve performance of strcat
- From: "Wilco Dijkstra" <wdijkstr at arm dot com>
- To: "'Carlos O'Donell'" <carlos at redhat dot com>, <libc-alpha at sourceware dot org>
- Date: Fri, 12 Sep 2014 12:14:35 +0100
- Subject: RE: [PATCH] Improve performance of strcat
- Authentication-results: sourceware.org; auth=none
- References: <000101cfb243$63a5b1b0$2af11510$ at com> <5411FB27 dot 6000007 at redhat dot com>
> Carlos O'Donell wrote:
> On 08/07/2014 09:27 AM, Wilco Dijkstra wrote:
> > Hi,
> >
> > This patch improves strcat performance by using strlen and strcpy. Strlen has a fast C
> > implementation, so this improves performance even on targets which don't have an optimized
> strlen
> > and strcpy - it is 25% faster in bench-strcat. On targets which don't provide an optimized
> strcat
> > but which do have an optimized strlen and strcpy, performance gain is > 2x.
>
> What benchmarks did you use to test this performance gain?
>
> Did you use glibc's microbenchmark?
>
> What numbers did you get?
These results are for the GLIBC benchtests/bench-strcat.c - I increased the iterations
significantly and profiled the results with a high tickrate to verify the timings.
65.74% 11343 bench-strcat bench-strcat [.] simple_strcat
24.90% 4307 bench-strcat libc-2.20.90.so [.] strcpy
5.20% 902 bench-strcat libc-2.20.90.so [.] strlen
1.22% 214 bench-strcat bench-strcat [.] do_test
1.08% 190 bench-strcat libc-2.20.90.so [.] strcat
So strcat+strlen+strcpy=31.18% vs simple_strcat 65.74%, ie. 2.1x speedup.
Wilco