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: Paul Eggert
Subject: bug#17229: [PATCH 2/2] grep: speed-up by using memchr() in Boyer-Moore searching
Date: Sat, 26 Apr 2014 21:04:13 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

Thanks for the test cases and patch. In my tests, switching to macros does not help performance, and that SWITCH macro's implementation actually slows things down a bit, which is what I'd expect. If there is a reason to use macros I'd like to see a patch that simply changes functions to macros without changing the algorithm, so that we can measure this effect separately from the algorithm change.

I attempted to suss out the performance improvements in that patch without using macros, and installed the attached changes. With these changes grep performs about as well as it does with that patch, on the benchmarks you mentioned that I tried (as before, I'm using the default optimization with GCC 4.9.0 x86-64 on an AMD Phenom II X4 910e). Quite possibly I've missed something, of course. The two "advance_*" constants used in the heuristics are guesses: I haven't measured rigorously to try to come up with good values.

Attachment: 0001-kwset-improve-performance-when-large-Boyer-Moore-key.patch
Description: Text document

Attachment: 0002-kwset-speed-up-by-using-memchr2.patch
Description: Text document


reply via email to

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