This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] powerpc: Optimized st{r,p}ncpy for POWER8/PPC64
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Adhemerval Zanella <azanella at linux dot vnet dot ibm dot com>
- Cc: "GNU C. Library" <libc-alpha at sourceware dot org>
- Date: Tue, 6 Jan 2015 19:53:17 +0100
- Subject: Re: [PATCH] powerpc: Optimized st{r,p}ncpy for POWER8/PPC64
- Authentication-results: sourceware.org; auth=none
- References: <54A59CAC dot 1070303 at linux dot vnet dot ibm dot com>
On Thu, Jan 01, 2015 at 05:14:52PM -0200, Adhemerval Zanella wrote:
> This patch adds an optimized POWER8 st{r,p}ncpy using unaligned accesses.
> It shows 10%-80% improvement over the optimized POWER7 one that uses
> only aligned accesses, specially on unaligned inputs.
>
This could hurt overall performance as strncpy/stpncpy are rarely used
and should be avoided where performance is concern. Optimizing for cache
usage would be better, I would not be surprised that runtime cost was
dominated by time these functions are read from disk/get into cache.
Also I would compare this with generic strnlen+memcpy to call power8
versions when possible.
Main question is why there is no power8 memcpy using unaligned loads yet?
Memcpy is called about hundred times more often than strcpy(and no
strncpy call) on my computer so possible gains are bigger and with
optimized memcpy a generic strncpy will be faster as well.