lkml.org 
[lkml]   [2010]   [Dec]   [9]   [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 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...



    \
     
     \ /
      Last update: 2010-12-10 03:41    [W:0.024 / U:0.488 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site