uniq: replace a wasteful loop with simple calculation

* src/uniq.c (find_field): Remove the byte-skipping loop altogether.
Instead, perform the simple calculation.  This results in a 10%
performance improvement for large byte offsets.
This commit is contained in:
Jim Meyering committed 2011-01-17 19:07:58 +01:00
1 parent 1f0653066c
commit bdaef0686f
1 file changed
+1 -2
+1 -2
View File
@@ -222,8 +222,7 @@ find_field (struct linebuffer const *line)
i++;
}
for (count = 0; count < skip_chars && i < size; count++)
i++;
i += MIN (skip_chars, size - i);
return line->buffer + i;
}