grep-commit
[Top][All Lists]
Advanced

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

grep branch, master, updated. v2.27-50-gf07b1b9


From: Paul Eggert
Subject: grep branch, master, updated. v2.27-50-gf07b1b9
Date: Thu, 2 Feb 2017 01:25:26 +0000 (UTC)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grep".

The branch, master has been updated
       via  f07b1b95dfc47ab9cc492f07aa485e4ffb1cb9dc (commit)
      from  20ca6364bd25c89fcded930dc63b7b6a67825b65 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=f07b1b95dfc47ab9cc492f07aa485e4ffb1cb9dc


commit f07b1b95dfc47ab9cc492f07aa485e4ffb1cb9dc
Author: Paul Eggert <address@hidden>
Date:   Mon Jan 30 00:04:40 2017 -0800

    grep: tune to avoid memchr2 sometimes
    
    Problem noted by Norihiro Tanaka in:
    http://lists.gnu.org/archive/html/grep-devel/2017-01/msg00027.html
    Although not enough to restore all the previous performance in the
    case he noted, it helps significantly.
    * src/kwset.c (memchr_kwset): Bring back small_heuristic,
    in a somewhat different form.

diff --git a/src/kwset.c b/src/kwset.c
index 3be5c42..cdfe8d1 100644
--- a/src/kwset.c
+++ b/src/kwset.c
@@ -639,12 +639,26 @@ bm_delta2_search (char const **tpp, char const *ep, char 
const *sp,
 static char const *
 memchr_kwset (char const *s, ptrdiff_t n, kwset_t kwset)
 {
-  if (0 <= kwset->gc1help)
-    return memchr2 (s, kwset->gc1, kwset->gc1help, n);
   char const *slim = s + n;
-  for (; s < slim; s++)
-    if (U(kwset->trans[U(*s)]) == kwset->gc1)
-      return s;
+  if (kwset->gc1help < 0)
+    {
+      for (; s < slim; s++)
+        if (kwset->next[U(*s)])
+          return s;
+    }
+  else
+    {
+      int small_heuristic = 2;
+      size_t small_bytes = small_heuristic * sizeof (unsigned long int);
+      while (s < slim)
+        {
+          if (kwset->next[U(*s)])
+            return s;
+          s++;
+          if ((uintptr_t) s % small_bytes == 0)
+            return memchr2 (s, kwset->gc1, kwset->gc1help, slim - s);
+        }
+    }
   return NULL;
 }
 

-----------------------------------------------------------------------

Summary of changes:
 src/kwset.c |   24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
grep



reply via email to

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