From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boaz Harrosh Subject: Re: Big git diff speedup by avoiding x86 "fast string" memcmp Date: Wed, 15 Dec 2010 15:15:09 +0200 Message-ID: <4D08BF5D.1060509@panasas.com> References: <20101209070938.GA3949@amd> <19324.1291990997@jrobl> <20101213014553.GA6522@amd> <9580.1292225351@jrobl> <12853.1292353313@jrobl> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: "J. R. Okajima" , Nick Piggin , Linus Torvalds , linux-arch@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org To: Nick Piggin Return-path: In-Reply-To: Sender: linux-arch-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On 12/15/2010 06:06 AM, Nick Piggin wrote: > > However instead of a normal memcmp, we could actually pad dentry > names out to sizeof(long) with zeros, and take advantage of that with > a memcmp that does not have to handle tails -- it would operate > entirely with longs. > > That would avoid icache and branch regressions, and might speed up > the operation on some architectures. I just doubted whether it would > show an improvement to be worth doing at all. If it does, I'm all for it. > I agree that the byte-compare or long-compare should give you very close results in modern pipeline CPUs. But surly 12 increments-and-test should show up against 3 (or even 2). I would say it must be a better plan. BTW the long approach if you assume that the beginning of the string is long aligned than it is only a matter of comparing the last byte with a mask, no branches. But I'm not saying, just make sure they are padded. Just my $0.017 Thanks Boaz