GNU C Library master sources branch master updated. glibc-2.28.9000-493-g5289f1f

wilco@sourceware.org wilco@sourceware.org
Thu Dec 27 14:57:00 GMT 2018


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  5289f1f56b7174da6b036d24a7626d9cd658fb01 (commit)
      from  ba4b8fab20d52e4c3c52fcff805c77219a9e8b5e (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=5289f1f56b7174da6b036d24a7626d9cd658fb01

commit 5289f1f56b7174da6b036d24a7626d9cd658fb01
Author: Wilco Dijkstra <wdijkstr@arm.com>
Date:   Thu Dec 27 14:56:23 2018 +0000

    Improve bench-strlen
    
    The current bench-strlen compares against a slow byte-oriented strlen which
    is not useful given it's too easy to beat.  Remove it and compare against the
    generic C strlen version and memchr.
    
    	* benchtests/bench-strlen.c (generic_strlen): New function.
    	(memchr_strlen): New function.

diff --git a/ChangeLog b/ChangeLog
index cb959e3..ea72d5e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-12-27  Wilco Dijkstra  <wdijkstr@arm.com>
+
+	* benchtests/bench-strlen.c (generic_strlen): New function.
+	 (memchr_strlen): New function.
+
 2018-12-26  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* sysdeps/x86_64/fpu/s_sincosf.S: Removed.
diff --git a/benchtests/bench-strlen.c b/benchtests/bench-strlen.c
index 4c26890..28ae31d 100644
--- a/benchtests/bench-strlen.c
+++ b/benchtests/bench-strlen.c
@@ -24,24 +24,15 @@
 #endif
 #include "bench-string.h"
 
-#ifndef WIDE
-# define MAX_CHAR CHAR_MAX
-#else
-# define MAX_CHAR WCHAR_MAX
-#endif
-
 #include "json-lib.h"
 
 typedef size_t (*proto_t) (const CHAR *);
 
-size_t
-simple_STRLEN (const CHAR *s)
-{
-  const CHAR *p;
+size_t generic_strlen (const CHAR *);
+size_t memchr_strlen (const CHAR *);
 
-  for (p = s; *p; ++p);
-  return p - s;
-}
+IMPL (memchr_strlen, 0)
+IMPL (generic_strlen, 0)
 
 #ifndef WIDE
 size_t
@@ -52,7 +43,12 @@ builtin_strlen (const CHAR *p)
 IMPL (builtin_strlen, 0)
 #endif
 
-IMPL (simple_STRLEN, 0)
+size_t
+memchr_strlen (const CHAR *p)
+{
+  return (const CHAR *)MEMCHR (p, 0, PTRDIFF_MAX) - p;
+}
+
 IMPL (STRLEN, 1)
 
 
@@ -161,3 +157,13 @@ test_main (void)
 }
 
 #include <support/test-driver.c>
+
+#define libc_hidden_builtin_def(X)
+#ifndef WIDE
+# undef STRLEN
+# define STRLEN generic_strlen
+# include <string/strlen.c>
+#else
+# define WCSLEN generic_strlen
+# include <wcsmbs/wcslen.c>
+#endif

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

Summary of changes:
 ChangeLog                 |    5 +++++
 benchtests/bench-strlen.c |   34 ++++++++++++++++++++--------------
 2 files changed, 25 insertions(+), 14 deletions(-)


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



More information about the Glibc-cvs mailing list