]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Optimize scripts/merge-test-results.sh
authorDJ Delorie <dj@redhat.com>
Wed, 1 Apr 2020 19:33:00 +0000 (15:33 -0400)
committerDJ Delorie <dj@redhat.com>
Mon, 5 Oct 2020 21:16:03 +0000 (17:16 -0400)
The inner loop is called thousands of times per "make check" even
if there's otherwise nothing to do.  Avoid calling /bin/head all
those times when a builtin will do.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
scripts/merge-test-results.sh

index 573a44d8cf18bb80432377be99f6d623e1ed5f5a..1e236db4a759ea9acb14a72c853bb070c6d0e132 100755 (executable)
@@ -35,7 +35,12 @@ case $type in
     subdir=${subdir:+$subdir/}
     for t in "$@"; do
       if [ -s "$objpfx$t.test-result" ]; then
-       head -n1 "$objpfx$t.test-result"
+       # This loop is called thousands of times even when there's
+       # nothing to do.  Avoid using non-built-in commands (like
+       # /bin/head) where possible.  We assume "echo" is typically a
+       # built-in.
+       IFS= read -r line < "$objpfx$t.test-result"
+       echo "$line"
       else
        echo "UNRESOLVED: $subdir$t"
       fi