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: Norihiro Tanaka
Subject: Re: [Grep-devel] [PATCH 2/2] grep: speed up Aho-Corasick when at most 2 bytes
Date: Thu, 19 Jan 2017 23:38:36 +0900

On Wed, 18 Jan 2017 15:53:17 -0800
Paul Eggert <address@hidden> wrote:

> When using Aho-Corasick and all matched strings either begin with
> the same byte, or begin with one of at most two bytes, use memchr2
> to search for these matching bytes and apply the Aho-Corasick
> algorithm only when a memchr2 match is found.  On my platform,
> this speeds up 'grep -F -e aa -e ba in' by a factor of 7, where
> the file 'in' was created by 'seq -f %040.0f 10000000 >in'.

Excellent!  However, Slight slowdown may be caused in following case.

  yes $(printf 0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c) | head -1000000 >inp
  time -p src/grep -F -e 0b -e ab inp

I think that it is not enough to mind.




reply via email to

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