grep-devel
[Top][All Lists]
Advanced

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

Re: [Grep-devel] [PATCH 2/2] grep: speed up Aho-Corasick when at most 2


From: Paul Eggert
Subject: Re: [Grep-devel] [PATCH 2/2] grep: speed up Aho-Corasick when at most 2 bytes
Date: Wed, 1 Feb 2017 17:41:16 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0

On 01/30/2017 02:24 PM, Jim Meyering wrote:

   yes $(printf 0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c) | head -1000000>inp

   time -p src/grep -F -e 0b -e ab inp


On an idle 3-year old i7-4770S with plenty of RAM, I ran the following
  commands before and after the patch, taking the best time out of 10:

   yes $(printf 0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c) | head -20000000 >inp
   for i in $(seq 10); do env time src/grep -F -e 0b -e ab inp; done

Before the patch, the best was 03.39elapsed.
After, it was 03.13elapsed, i.e., taking 7.6% less time.
I compiled with -O2 and a very recent gcc: version 7.0.1 20170127
(experimental) (GCC)

I tried a quite-different platform and got about a 25% speedup. This is an old Sun Fire 280R with an 750 MHz UltraSPARC III, compiled with 32-bit Oracle Studio 12.5 (2016) with -xO4 and running Solaris 10.

Since the patch helps performance significantly on some platforms and doesn't seem to hurt on any, and since it's a small patch that is unlikely to break things, I installed it.



reply via email to

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