From 7142c342aed30f8b7f2e9e218f5d70cd5688e04a Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Sat, 1 Jan 2011 04:07:57 -0800 Subject: [PATCH] minimal/do: faster deletion of stamp files. "while/read/printf | xargs -0" is much faster than while/read/rm, because it doesn't fork so many times. --- minimal/do | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/minimal/do b/minimal/do index f22c7f8..c5302bd 100755 --- a/minimal/do +++ b/minimal/do @@ -22,7 +22,8 @@ if [ -z "$DO_BUILT" ]; then if [ -e "$DO_BUILT" ]; then echo "Removing previously built files..." >&2 sort -u "$DO_BUILT" | tee "$DO_BUILT.new" | - while read f; do rm -f "$f" "$f.did" 2>/dev/null; done + while read f; do printf "%s\0%s.did\0" "$f" "$f"; done | + xargs -0 rm -f 2>/dev/null mv "$DO_BUILT.new" "$DO_BUILT" fi DO_PATH=$DO_BUILT.dir @@ -114,5 +115,6 @@ fi if [ -n "$DO_TOP" ]; then echo "Removing stamp files..." >&2 - while read f; do rm -f "$f.did" 2>/dev/null; done <"$DO_BUILT" + while read f; do printf "%s.did\0" "$f"; done <"$DO_BUILT" | + xargs -0 rm -f 2>/dev/null fi