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.20-122-ge80514b


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  e80514b5a87c86a92352ce526c4b9db85f2a242c (commit)
       via  6e46de42fe1695818a410a7b86d26be8b1527524 (commit)
      from  6a9ad2faee48c5a9befd5ad6af79df37e4ea5436 (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=e80514b5a87c86a92352ce526c4b9db85f2a242c

commit e80514b5a87c86a92352ce526c4b9db85f2a242c
Author: Wilco Dijkstra <wdijkstr@arm.com>
Date:   Fri Oct 24 16:12:12 2014 +0000

    This patch improves strncat performance by using strlen. Strlen has a fast C implementation, so
    this
    will improve performance even on targets which don't have an optimized strlen. It is about twice
    as
    fast as the original strncat in bench-strncat.

diff --git a/ChangeLog b/ChangeLog
index f73c55e..40e294b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2014-10-24  Wilco Dijkstra  <wdijkstr@arm.com>
 
+	* string/strncat.c (strncat): Improve performance by using strlen.
+
+2014-10-24  Wilco Dijkstra  <wdijkstr@arm.com>
+
 	* string/strcat.c (strcat): Improve performance by using strlen/strcpy.
 
 2014-10-24  Wilco Dijkstra  <wdijkstr@arm.com>
diff --git a/string/strncat.c b/string/strncat.c
index 7ac4456..6d29114 100644
--- a/string/strncat.c
+++ b/string/strncat.c
@@ -33,13 +33,11 @@ STRNCAT (char *s1, const char *s2, size_t n)
   char *s = s1;
 
   /* Find the end of S1.  */
-  do
-    c = *s1++;
-  while (c != '\0');
+  s1 += strlen (s1);
 
   /* Make S1 point before next character, so we can increment
      it while memory is read (wins on pipelined cpus).  */
-  s1 -= 2;
+  s1 -= 1;
 
   if (n >= 4)
     {

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=6e46de42fe1695818a410a7b86d26be8b1527524

commit 6e46de42fe1695818a410a7b86d26be8b1527524
Author: Wilco Dijkstra <wdijkstr@arm.com>
Date:   Fri Oct 24 16:08:42 2014 +0000

    This patch improves strcat performance by using strlen and strcpy. Strlen has a fast C
    implementation, so this improves performance even on targets which don't have an optimized
    strlen and strcpy - it is 25% faster in bench-strcat. On targets which don't provide an
    optimized strcat but which do have an optimized strlen and strcpy, performance gain is > 2x.

diff --git a/ChangeLog b/ChangeLog
index 98548cb..f73c55e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2014-10-24  Wilco Dijkstra  <wdijkstr@arm.com>
 
+	* string/strcat.c (strcat): Improve performance by using strlen/strcpy.
+
+2014-10-24  Wilco Dijkstra  <wdijkstr@arm.com>
+
 	* sysdeps/aarch64/fpu/fgetexcptflg.c (fegetexceptflag):
 	Call libc_fetestexcept_aarch64.
 
diff --git a/string/strcat.c b/string/strcat.c
index 2cbe8b3..983d115 100644
--- a/string/strcat.c
+++ b/string/strcat.c
@@ -23,26 +23,7 @@
 char *
 strcat (char *dest, const char *src)
 {
-  char *s1 = dest;
-  const char *s2 = src;
-  char c;
-
-  /* Find the end of the string.  */
-  do
-    c = *s1++;
-  while (c != '\0');
-
-  /* Make S1 point before the next character, so we can increment
-     it while memory is read (wins on pipelined cpus).  */
-  s1 -= 2;
-
-  do
-    {
-      c = *s2++;
-      *++s1 = c;
-    }
-  while (c != '\0');
-
+  strcpy (dest + strlen (dest), src);
   return dest;
 }
 libc_hidden_builtin_def (strcat)

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

Summary of changes:
 ChangeLog        |    8 ++++++++
 string/strcat.c  |   21 +--------------------
 string/strncat.c |    6 ++----
 3 files changed, 11 insertions(+), 24 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]