summaryrefslogtreecommitdiff
path: root/tests/misc/cut-huge-range.sh
diff options
context:
space:
mode:
authorCojocaru Alexandru <xojoc@gmx.com>2013-04-28 03:03:45 +0100
committerPádraig Brady <P@draigBrady.com>2013-04-29 17:54:39 +0100
commitef9db5735a401f60eb5b4a18a365bf1ece525053 (patch)
tree836c6d92830d2fa3037e2378e4277dc634bb81ef /tests/misc/cut-huge-range.sh
parent3e466ad05181d95057e6612ff11059c91396cd0e (diff)
downloadcoreutils-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 'tests/misc/cut-huge-range.sh')
-rwxr-xr-xtests/misc/cut-huge-range.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/misc/cut-huge-range.sh b/tests/misc/cut-huge-range.sh
index 8783e96ad..887197ae9 100755
--- a/tests/misc/cut-huge-range.sh
+++ b/tests/misc/cut-huge-range.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Ensure that cut does not allocate mem for a range like -b9999999999999-
+# Ensure that cut does not allocate mem for large ranges
# Copyright (C) 2012-2013 Free Software Foundation, Inc.