coreutils
[Top][All Lists]
Advanced

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

[coreutils] [PATCH] join: improve performance when operating on whole li


From: Pádraig Brady
Subject: [coreutils] [PATCH] join: improve performance when operating on whole lines
Date: Tue, 31 Aug 2010 10:08:53 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3

    Following on from commit f86bb696, 01-02-2010,
    "join: make -t '' operate on the whole line".
    Bypassing the delimiter search in this case,
    was seen to give around an 8% performance boost.
    
    * src/join (xfields): Don't bother looking for '\n'
    in the data, which we know won't be present.

diff --git a/src/join.c b/src/join.c
index fa18c9d..f3a7288 100644
--- a/src/join.c
+++ b/src/join.c
@@ -249,13 +249,13 @@ xfields (struct line *line)
   if (ptr == lim)
     return;
 
-  if (0 <= tab)
+  if (0 <= tab && tab != '\n')
     {
       char *sep;
       for (; (sep = memchr (ptr, tab, lim - ptr)) != NULL; ptr = sep + 1)
         extract_field (line, ptr, sep - ptr);
     }
-  else
+  else if (0 > tab)
     {
       /* Skip leading blanks before the first field.  */
       while (isblank (to_uchar (*ptr)))




reply via email to

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