This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Simplify strncat.
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Roland McGrath <roland at hack dot frob dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 17 Dec 2014 17:32:06 +0100
- Subject: Re: [PATCH] Simplify strncat.
- Authentication-results: sourceware.org; auth=none
- References: <20141216202438 dot GA5612 at domone> <20141216203638 dot D237C2C2448 at topped-with-meat dot com>
On Tue, Dec 16, 2014 at 12:36:38PM -0800, Roland McGrath wrote:
> Use '\0', not '\000'.
>
> IIRC we have a general policy about having a benchtests case and citing
> numbers on that.
That is not policy as benchtest results on string function are still
meaningless. Here I could simply improve benchtest score by inlining
strnlen and memcpy implementations, for example with
#define memcpy memcpy2
#include <string/memcpy.c>
As it avoids call overhead. However it would be big mistake to do that
"optimization" as strncat is cold function while memcpy is likely in
memory it degrade performance due to additonal icache misses.