bug-grep
[Top][All Lists]
Advanced

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

bug#17229: [PATCH 2/2] grep: speed-up by using memchr() in Boyer-Moore s


From: Norihiro Tanaka
Subject: bug#17229: [PATCH 2/2] grep: speed-up by using memchr() in Boyer-Moore searching
Date: Thu, 10 Apr 2014 20:37:45 +0900

Hi Paul,
Hi Paul,

Thanks for the review for the patch.

> What benchmark did you use to time this?

I measured below.

$ yes jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj | head -10000000 >k

Before:
$ time -p env LANG=C src/grep jk k
real 1.53
user 1.21
sys 0.31

After:
$ time -p env LANG=C src/grep jk k
real 0.33
user 0.03
sys 0.29

> Is there some other patch that establishes this variable, a patch that
> is a prerequisite for this one?

The patch requires below.

bug#17230
[PATCH 1/2] grep: may also use Boyer-Moore algorithm for case-insensitive 
matching

> What is delta1?  It's mentioned in a comment but not in the code.

It means `d1' in kwset.c:bmexec.

> It'd be simpler to use memchr on all platforms;
> is there a major performance downside to that?

Yes.  As far as I was confirmed, it's slow in HP-UX on Itanium and
Solaris on SPARC.  I think that that it depends on the implementation of
memchr() and the rate of the increment instruction for the `add'
instruction on the platform.

Norihiro






reply via email to

[Prev in Thread] Current Thread [Next in Thread]