Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
darcs record speed test scripts
# Makefile.linux
# The mac makefile is more up to date.
TIME=/usr/bin/time -f%E
DARCS=darcs
test:
for N in \
100 200 300 400 500 600 700 800 900 \
1000 2000 3000 4000 5000 6000 7000 8000 9000 \
; do printf "[`date +%H:%M:%S`] recording $$N files: "; printf "`make -s test$$N`" ; done
# time darcs operations in a darcs repo with this many files
test%:
@make -s t$*
-@cd t$*; \
rm -rf _darcs; \
$(DARCS) init -q; \
$(DARCS) add -q *; \
$(TIME) $(DARCS) record -am 'record' -q >/dev/null
# make a test directory with N files. Must be the last make target beginning with t.
t%: dict
mkdir -p $@; cd $@; for w in $$(head -$* ../dict); do echo $$w > $$w; done
# make a dictionary of simple unique ascii words
dict:
strings /usr/share/dict/words | grep -v \' | sort | uniq > $@
clean:
rm -rf t[0-9]*/_darcs
# Makefile.mac
DARCS=darcs
MAKE=make -s -fMakefile.mac
#RANGE=100 200 300 400 500 600 700 800 900
RANGE=1000 2000 3000 4000 5000 6000 7000 8000 9000
#RANGE=1000 2000 3000
# TESTS=\
# do-record-added \
# do-record-l-added \
# do-record-edited \
# do-whatsnew-unadded \
# do-whatsnew-added \
TESTS=\
do-record-l-added \
do-record-edited \
do-whatsnew-unadded \
do-whatsnew-added \
test: $(TESTS)
# run each specified test-RULE for a range of file counts.
# eg: make do-record-edited
do-%:
@for N in $(RANGE); do $(MAKE) test-$*-$$N ; done
@echo
# time darcs whatsnew with this many unadded files
test-whatsnew-unadded-%:
@printf "[`date +%H:%M:%S`] whatsnew with $* unadded files: "
@$(MAKE) tmp$*
cd tmp$*; \
rm -rf _darcs; \
$(DARCS) init >/dev/null; \
( time ( $(DARCS) whatsnew -s ) ) 2>&1 | grep real
# time darcs whatsnew with this many pending added files
test-whatsnew-added-%:
@printf "[`date +%H:%M:%S`] whatsnew with $* pending added files: "
@$(MAKE) tmp$*
cd tmp$*; \
rm -rf _darcs; \
$(DARCS) init >/dev/null; \
$(DARCS) add -q *; \
( time ( $(DARCS) whatsnew -s ) ) 2>&1 | grep real
# time darcs record of this many new files, using add
test-record-added-%:
@printf "[`date +%H:%M:%S`] recording $* added files: "
@$(MAKE) tmp$*
cd tmp$*; \
rm -rf _darcs; \
$(DARCS) init >/dev/null; \
$(DARCS) add -q *; \
( time ( $(DARCS) record -am added ) ) 2>&1 | grep real
# time darcs record of this many new files, using -l
test-record-l-added-%:
@printf "[`date +%H:%M:%S`] recording $* added files with -l: "
@$(MAKE) tmp$*
cd tmp$*; \
rm -rf _darcs; \
$(DARCS) init >/dev/null; \
( time ( $(DARCS) record -alm added ) ) 2>&1 | grep real
# time darcs record of this many edited files
test-record-edited-%:
@printf "[`date +%H:%M:%S`] recording $* edited files: "
@$(MAKE) tmp$*
cd tmp$*; \
rm -rf _darcs; \
$(DARCS) init >/dev/null; \
$(DARCS) record -qalm added; \
for F in [A-Za-z]*; do echo >>$$F; done; \
( time ( $(DARCS) record -am edited ) ) 2>&1 | grep real
# make a tmpN test directory containing ~N files.
tmp%: dict
mkdir -p $@; cd $@; for w in $$(head -$* ../dict); do echo $$w > $$w; done
# make a dictionary of simple unique ascii words
dict:
strings /usr/share/dict/words | grep -v \' | sort | uniq > $@
clean:
rm -rf tmp[0-9]*/_darcs
Clean:
rm -rf tmp* dict
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.