lkml.org 
[lkml]   [2010]   [Dec]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Big git diff speedup by avoiding x86 "fast string" memcmp
On Wed, Dec 15, 2010 at 03:09:26PM -0800, Tony Luck wrote:
> On Wed, Dec 8, 2010 at 11:09 PM, Nick Piggin <npiggin@kernel.dk> 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;
> > +}
>
> Since you are proposing a routine that only compares file
> names - I wonder whether it would be faster to start at the
> end and work backwards? If the filenames are the same,
> it makes no difference - you have to look at all the bytes.
> But if they are different you might bail out earlier. There
> are many applications that stick a common prefix onto
> the start of filenames (just look in "/lib" !), but I think it is
> less common to add a suffix (longer than "." single letter).

That's true, and an interesting point. However I have managed to fit
the first 8 bytes of the name (in the case of shortnames) into the
same single dentry cacheline that is used for path walking. So that
might negate some of the benefits of walking backwards.

I would encourage anybody to grab the branch and try out any tweaks,
though...

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2010-12-16 03:37    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site