"make check" times

DJ Delorie dj@redhat.com
Wed Apr 1 19:35:58 GMT 2020


Carlos writes:
> This is worth it.

Thanks - reviewed-by removed as the patch has changed.

Andreas writes:
> Why do you need to use the exec dance?

Uneeded, fixed.

Joseph writes:
> It definitely needs a comment in the script

Added.

Ok now?

>From 7af6c4b85394fd6cd2988e73331d6a0bc4ee4882 Mon Sep 17 00:00:00 2001
From: DJ Delorie <dj@redhat.com>
Date: Wed, 1 Apr 2020 15:33:00 -0400
Subject: 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.

diff --git a/scripts/merge-test-results.sh b/scripts/merge-test-results.sh
index 573a44d8cf..6fd0a28dc8 100755
--- a/scripts/merge-test-results.sh
+++ b/scripts/merge-test-results.sh
@@ -35,7 +35,11 @@ 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.
+	read line <"$objpfx$t.test-result"
+	echo $line
       else
 	echo "UNRESOLVED: $subdir$t"
       fi



More information about the Libc-alpha mailing list