This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Do not multiply by zero in bzero.


On Thu, Mar 21, 2013 at 04:40:37PM -0400, Carlos O'Donell wrote:
> On 03/21/2013 12:20 PM, OndÅej BÃlka wrote:
> > Hello,
> > 
> > I noticed that bzero jumps directly at memset. Memset then computes mask
> > by 64bit multiplication. This is suboptimal in bzero case as mask iz
> > zero.
> > 
> > I emulating first few instructions of memset and simplified it. 
> > 
> > Related question is that we first check if n==1. In my profile this
> > happens only with 2% of cases. Is there special reason to keep it?
> 
> I agree that it seems odd to have a special case for n==1 with
> no comment or indication why that might be better.
> 
> Please post as distinct patch with that change to remove the
> n==1 check and provide some performance numbers if it actually
> makes a difference. If it doesn't then at least it's a code size
> win, which is usually a performance win by reducing cache size.
> 
I also replaced computed jump there and I posted incomplete new implementation in
http://sourceware.org/ml/libc-alpha/2013-03/msg00546.html
Now I am at phase collect real world data, 
I cannot compare it directly as memset is used in linker. I plan record
inputs.

> > Passes test on x86-64. OK to commit?
> > 
> 
> Richard has already commented on the assembly.
> 
> Post a follow-up version.
>
posted, is follow-up ok? 
> Cheers,
> Carlos.

Ondra


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]