public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] Optimize scripts/merge-test-results.sh
@ 2020-10-05 21:17 DJ Delorie
  0 siblings, 0 replies; only message in thread
From: DJ Delorie @ 2020-10-05 21:17 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=78e09591a59fb4cb634cde28089924383151fcfe

commit 78e09591a59fb4cb634cde28089924383151fcfe
Author: DJ Delorie <dj@redhat.com>
Date:   Wed Apr 1 15:33:00 2020 -0400

    Optimize scripts/merge-test-results.sh
    
    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>

Diff:
---
 scripts/merge-test-results.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/scripts/merge-test-results.sh b/scripts/merge-test-results.sh
index 573a44d8cf..1e236db4a7 100755
--- a/scripts/merge-test-results.sh
+++ b/scripts/merge-test-results.sh
@@ -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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-05 21:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-05 21:17 [glibc] Optimize scripts/merge-test-results.sh DJ Delorie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).