mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
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:
1 parent
1f0653066c
commit
bdaef0686f
1 file changed
+1
-2
+1
-2
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user