grep-commit
[Top][All Lists]
Advanced

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

grep branch, master, updated. v2.13-11-g8c74af8


From: Jim Meyering
Subject: grep branch, master, updated. v2.13-11-g8c74af8
Date: Thu, 02 Aug 2012 12:12:29 +0000

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  8c74af84958634a22a24dbc7fecf3fafd3f8e4bd (commit)
      from  624fb2824cc4f318caf99c3912cfb0ad6c74b418 (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=8c74af84958634a22a24dbc7fecf3fafd3f8e4bd


commit 8c74af84958634a22a24dbc7fecf3fafd3f8e4bd
Author: Jim Meyering <address@hidden>
Date:   Mon Jul 30 11:39:29 2012 +0200

    maint: optimize long-line processing
    
    * src/main.c (grep): Use memrchr rather than an open-coded loop,
    reducing the cost of the replaced code by 50% when processing very
    long lines.  If there were a rawmemrchr function (analogous to glibc's
    rawmemchr), then the performance improvement would be even greater.

diff --git a/src/main.c b/src/main.c
index 84066d8..e3b5186 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1200,8 +1200,10 @@ grep (int fd, struct stat const *st)
          the buffer, 0 means there is no incomplete last line).  */
       oldc = beg[-1];
       beg[-1] = eol;
-      for (lim = buflim; lim[-1] != eol; lim--)
-        continue;
+      /* FIXME: use rawmemrchr if/when it exists, since we have ensured
+         that this use of memrchr is guaranteed never to return NULL.  */
+      lim = memrchr (beg - 1, eol, buflim - beg + 1);
+      ++lim;
       beg[-1] = oldc;
       if (lim == beg)
         lim = beg - residue;

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

Summary of changes:
 src/main.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
grep



reply via email to

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