From de042fc2f2a5b05b52c0cb91a5dc468403b7413f Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Sun, 21 Nov 2010 00:31:48 -0800 Subject: [PATCH] t/curse: add a Makefile so we can compare speed when using GNU make. redo: 5.4s redo -j4: 3.0s make: 2.3s make -j4: 1.4s make SHELL=/bin/dash: 1.2s make SHELL=/bin/dash -j4: 0.83s We have some distance to go yet. Of course, redo is still written in python, not C, so it's very expensive, and the on-disk dependency store is very inefficient. --- t/curse/Makefile | 26 ++++++++++++++++++++++++++ t/curse/all.do | 17 ++--------------- t/curse/check-1.sh | 3 +++ t/curse/check-2.sh | 12 ++++++++++++ t/curse/clean.do | 2 +- 5 files changed, 44 insertions(+), 16 deletions(-) create mode 100644 t/curse/Makefile create mode 100644 t/curse/check-1.sh create mode 100644 t/curse/check-2.sh diff --git a/t/curse/Makefile b/t/curse/Makefile new file mode 100644 index 0000000..a0b5862 --- /dev/null +++ b/t/curse/Makefile @@ -0,0 +1,26 @@ +all: + . ./check-1.sh + $(MAKE) 1.n0 2.n0 3.n0 + $(MAKE) $(shell seq 10 | sed 's/$$/.n1/') + . ./check-2.sh + +%.n0: $(shell seq 10 | sed 's/$$/.n1/') + : >$@ + +%.n1: $(shell seq 100 | sed 's/$$/.n2/') + echo n1-$* >$@ + +.PRECIOUS: %.n2 +%.n2: + echo n2-$* >$@ + echo $* >>$*.count + echo $* >>in.countall + $(MAKE) countall + +.PHONY: countall +countall: + echo $@ >>out.countall + echo hello >$@ + +clean: + rm -f *~ .*~ *.n0 *.n1 *.n2 *.tmp *.count countall *.countall diff --git a/t/curse/all.do b/t/curse/all.do index fc04451..1482456 100644 --- a/t/curse/all.do +++ b/t/curse/all.do @@ -1,18 +1,5 @@ -rm -f in.countall out.countall *.count -touch in.countall out.countall -echo x >x.count +. ./check-1.sh redo-ifchange 1.n0 2.n0 3.n0 DEPS=$(seq 10 | sed 's/$/.n1/') redo-ifchange $DEPS -COUNT_IN=$(ls *.count | wc -l) -COUNT_OUT=$(cat *.count | wc -l) -if [ "$COUNT_IN" != "$COUNT_OUT" ]; then - echo "expected $COUNT_IN individual writes, got $COUNT_OUT" >&2 - exit 42 -fi -COUNTALL_IN=$(cat in.countall | wc -l) -COUNTALL_OUT=$(cat out.countall | wc -l) -if [ "$COUNTALL_IN" != "$COUNTALL_OUT" ]; then - echo "expected $COUNTALL_IN allwrites, got $COUNTALL_OUT" >&2 - exit 43 -fi +. ./check-2.sh diff --git a/t/curse/check-1.sh b/t/curse/check-1.sh new file mode 100644 index 0000000..6243eca --- /dev/null +++ b/t/curse/check-1.sh @@ -0,0 +1,3 @@ +rm -f in.countall out.countall *.count +touch in.countall out.countall +echo x >x.count diff --git a/t/curse/check-2.sh b/t/curse/check-2.sh new file mode 100644 index 0000000..87061af --- /dev/null +++ b/t/curse/check-2.sh @@ -0,0 +1,12 @@ +COUNT_IN=$(ls *.count | wc -l) +COUNT_OUT=$(cat *.count | wc -l) +if [ "$COUNT_IN" != "$COUNT_OUT" ]; then + echo "expected $COUNT_IN individual writes, got $COUNT_OUT" >&2 + exit 42 +fi +COUNTALL_IN=$(cat in.countall | wc -l) +COUNTALL_OUT=$(cat out.countall | wc -l) +if [ "$COUNTALL_IN" != "$COUNTALL_OUT" ]; then + echo "expected $COUNTALL_IN allwrites, got $COUNTALL_OUT" >&2 + exit 43 +fi diff --git a/t/curse/clean.do b/t/curse/clean.do index c34c50e..58c0381 100644 --- a/t/curse/clean.do +++ b/t/curse/clean.do @@ -1,3 +1,3 @@ -rm -f *~ .*~ *.n1 *.n2 *.tmp *.count countall *.countall +rm -f *~ .*~ *.n0 *.n1 *.n2 *.tmp *.count countall *.countall