I installed this, from coreutils (diff -pubw format):

2006-08-15  Paul Eggert  <[EMAIL PROTECTED]>

        * lib/memcoll.c (memcoll): Optimize for the common case where the
        arguments are bytewise equal.

--- lib/memcoll.c       19 Sep 2005 17:28:14 -0000      1.14
+++ lib/memcoll.c       15 Aug 2006 21:46:42 -0000
@@ -38,6 +38,14 @@ memcoll (char *s1, size_t s1len, char *s
 
 #if HAVE_STRCOLL
 
+  /* strcoll is slow on many platforms, so check for the common case
+     where the arguments are bytewise equal.  Otherwise, walk through
+     the buffers using strcoll on each substring.  */
+
+  if (s1len == s2len && memcmp (s1, s2, s1len) == 0)
+    diff = 0;
+  else
+    {
   char n1 = s1[s1len];
   char n2 = s2[s2len];
 
@@ -71,6 +79,7 @@ memcoll (char *s1, size_t s1len, char *s
 
   s1[s1len - 1] = n1;
   s2[s2len - 1] = n2;
+    }
 
 #else
 


Reply via email to