This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Improve performance of strcat
- From: Adhemerval Zanella <azanella at linux dot vnet dot ibm dot com>
- To: libc-alpha at sourceware dot org
- Date: Thu, 07 Aug 2014 10:31:32 -0300
- Subject: Re: [PATCH] Improve performance of strcat
- Authentication-results: sourceware.org; auth=none
- References: <000101cfb243$63a5b1b0$2af11510$ at com>
On 07-08-2014 10:27, 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.
>
> OK for commit?
>
> ChangeLog:
> 2014-08-07 Wilco Dijkstra <wdijkstr@arm.com>
>
> * string/strcat.c (strcat): Improve performance by using strlen/strcpy.
> ---
> string/strcat.c | 21 +--------------------
> 1 file changed, 1 insertion(+), 20 deletions(-)
>
> diff --git a/string/strcat.c b/string/strcat.c
>
> - do
> - {
> - c = *s2++;
> - *++s1 = c;
> - }
> - while (c != '\0');
> -
> + strcpy (dest + strlen (dest), src);
Should it be __strcpy/__strlen ?