|
From: | Paul Eggert |
Subject: | bug#17229: [PATCH 2/2] grep: speed-up by using memchr() in Boyer-Moore searching |
Date: | Wed, 09 Apr 2014 17:35:31 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 |
On 04/09/2014 06:54 AM, Norihiro Tanaka wrote:
memchr() of glibc is faster than seeking by delta1 on some platforms. So, when there is no chance to match for a while, use it on them. Speed-up about 3x in best case, 10% in normal case by this patch. It's still available only for x86 and x86-64 platform.
Thanks, I have some questions about this one. What benchmark did you use to time this?THe patch refers to a variable called 'trans' that is not in the current savannah git master. Is there some other patch that establishes this variable, a patch that is a prerequisite for this one? If trans is a cached copy of kwset->trans, isn't that guaranteed to be NULL here?
What is delta1? It's mentioned in a comment but not in the code.It'd be simpler to use memchr on all platforms; is there a major performance downside to that? For example, what about the attached patch instead? It also simplifies things a bit to avoid a label and its associated gotos, under the assumption that trans is NULL here.
memchr.diff
Description: Text Data
[Prev in Thread] | Current Thread | [Next in Thread] |