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

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

 



On Wed, Dec 8, 2010 at 11:09 PM, Nick Piggin <npiggin@xxxxxxxxx> 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).

-Tony
--
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