diff options
author | Cojocaru Alexandru <xojoc@gmx.com> | 2013-04-28 03:03:45 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2013-04-29 17:54:39 +0100 |
commit | ef9db5735a401f60eb5b4a18a365bf1ece525053 (patch) | |
tree | 836c6d92830d2fa3037e2378e4277dc634bb81ef /src/copy.c | |
parent | 3e466ad05181d95057e6612ff11059c91396cd0e (diff) | |
download | coreutils-ef9db5735a401f60eb5b4a18a365bf1ece525053.tar.xz |
cut: reduce CPU overhead in determining item to output
print_kth() is the central function of cut used to
determine if an item is to be output or not,
so simplify it by moving some logic outside.
Benchmark results for this change are:
$ yes abcdfeg | head -n1MB > big-file
$ for c in orig split; do
src/cut-$c 2>/dev/null
echo -ne "\n== $c =="
time src/cut-$c -b1,3 big-file > /dev/null
done
== orig ==
real 0m0.111s
user 0m0.108s
sys 0m0.002s
== split ==
real 0m0.088s
user 0m0.081s
sys 0m0.007s
* src/cut.c (print_kth): Refactor a branch to outside the function.
Related to http://bugs.gnu.org/13127
Diffstat (limited to 'src/copy.c')
0 files changed, 0 insertions, 0 deletions