Re: Big git diff speedup by avoiding x86 "fast string" memcmp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 09, 2010 at 02:37:09PM +0100, Borislav Petkov wrote:
> On Thu, Dec 09, 2010 at 06:09:38PM +1100, Nick Piggin wrote:
> > +static inline int dentry_memcmp(const unsigned char *cs,
> > +				const unsigned char *ct, size_t count)
> > +{
> > +	while (count) {
> > +		int ret = (*cs != *ct);
> > +		if (ret)
> > +			return ret;
> > +		cs++;
> > +		ct++;
> > +		count--;
> > +	}
> > +	return 0;
> > +}
> 
> we have a memcmp() in lib/string.c. Maybe reuse it from there?

Well I think I prefer it to be inline so it doesn't clobber registers,
and also so that it isn't required to carry an integer value to return
(only boolean) if that might help.

I might also change it a bit and take advantage of the fact we won't
have a zero sized count -- this could move the loop branch to after the
values are loaded, and would mean that the load will get underway
even if the branch is mispredicted...

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux