From: Al Viro <viro@ZenIV.linux.org.uk>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, npiggin@kernel.dk
Subject: Re: [PATCH] dcache: faster dentry_cmp()
Date: Tue, 14 Feb 2012 22:58:39 +0000 [thread overview]
Message-ID: <20120214225839.GA23916@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20120214224526.GA3478@p183.telecom.by>
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...
next prev parent reply other threads:[~2012-02-14 22:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-14 22:45 [PATCH] dcache: faster dentry_cmp() Alexey Dobriyan
2012-02-14 22:58 ` Al Viro [this message]
2012-02-15 8:14 ` Alexey Dobriyan
2012-02-15 1:41 ` Matthew Wilcox
2012-02-15 8:14 ` Alexey Dobriyan
2012-02-15 1:46 ` Andi Kleen
2012-02-15 8:16 ` Alexey Dobriyan
2012-02-15 11:19 ` Alexey Dobriyan
2012-02-15 20:20 ` Andi Kleen
2012-04-20 12:06 ` Nick Piggin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120214225839.GA23916@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=adobriyan@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=npiggin@kernel.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).