Re: [PATCH] dcache: faster dentry_cmp()

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

 



On Tue, Feb 14, 2012 at 10:58:39PM +0000, Al Viro wrote:
> On Wed, Feb 15, 2012 at 01:45:27AM +0300, Alexey Dobriyan wrote:
> > 1) consistently use "unsigned int" for dentry name length,
> > 2) reuse subtraction result for return value, exact value doesn't matter
> >    because function is only used in boolean context,
> > 3) use *p++ idiom for even better code.
> > 
> > All of this results in performance speedup of "git diff"
> > which is way out of statistical error (0.4% vs 0.15% of 3 sigma):
> 
> > -	if (scount != tcount)
> > -		return 1;
> > +
> > +	ret = scount - tcount;
> > +	if (ret)
> > +		return ret;
> >  	do {
> > -		ret = (*cs != *ct);
> > +		ret = *cs++ - *ct++;
> >  		if (ret)
> >  			break;
> > -		cs++;
> > -		ct++;
> >  		tcount--;
> >  	} while (tcount);
> >  	return ret;
> 
> I wonder what'll happen if you simply replace that loop with
> 	return memcmp(cs, ct, tcount);
> which is what it really is...

It was memcmp() at some point and Nick changed it and it became faster.
See 9d55c369bb5e695e629bc35cba2ef607755b3bee
"fs: implement faster dentry memcmp".
--
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