This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.28.9000-100-gc8dd67e


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 "GNU C Library master sources".

The branch, master has been updated
       via  c8dd67e7c958de04c3783cbea7c384431707b5f8 (commit)
      from  5abedf97a3d396798cb48a3bf86f322d71955ad9 (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://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=c8dd67e7c958de04c3783cbea7c384431707b5f8

commit c8dd67e7c958de04c3783cbea7c384431707b5f8
Author: Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com>
Date:   Tue Aug 28 12:42:19 2018 +0530

    Speedup first memmem match
    
    As done in commit 284f42bc778e487dfd5dff5c01959f93b9e0c4f5, memcmp
    can be used after memchr to avoid the initialization overhead of the
    two-way algorithm for the first match.  This has shown improvement
    >40% for first match.

diff --git a/ChangeLog b/ChangeLog
index 8419d46..2a25097 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2018-08-28  Rajalakshmi Srinivasaraghavan  <raji@linux.vnet.ibm.com>
+
+	* string/memmem.c: Use memcmp for first match.
+
 2018-08-28  Rafal Luzynski  <digitalfreak@lingonborough.com>
 
 	[BZ #17426]
diff --git a/string/memmem.c b/string/memmem.c
index 43efaa3..d72b824 100644
--- a/string/memmem.c
+++ b/string/memmem.c
@@ -70,6 +70,10 @@ __memmem (const void *haystack_start, size_t haystack_len,
       haystack_len -= haystack - (const unsigned char *) haystack_start;
       if (haystack_len < needle_len)
 	return NULL;
+      /* Check whether we have a match.  This improves performance since we
+	 avoid the initialization overhead of the two-way algorithm.  */
+      if (memcmp (haystack, needle, needle_len) == 0)
+	return (void *) haystack;
       return two_way_short_needle (haystack, haystack_len, needle, needle_len);
     }
   else

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

Summary of changes:
 ChangeLog       |    4 ++++
 string/memmem.c |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]