~ chicken-core (chicken-5) 9dfcbeff37a76358653680f6afc2032ea0d87ab3


commit 9dfcbeff37a76358653680f6afc2032ea0d87ab3
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Fri May 14 12:56:36 2010 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Fri May 14 12:56:36 2010 +0200

    added benchmark target and script

diff --git a/Makefile b/Makefile
index feec4d39..5867e85b 100644
--- a/Makefile
+++ b/Makefile
@@ -35,7 +35,7 @@ endif
 
 STANDARD_TARGETS \
 	= all clean distclean spotless install uninstall confclean check \
-	  fullcheck dist libs install-target
+	  fullcheck dist libs install-target bench
 
 SRCDIR = .
 
@@ -77,6 +77,8 @@ confclean:
 	$(MAKE) -f $(SRCDIR)/Makefile.$(PLATFORM) CONFIG=$(CONFIG) confclean
 check:
 	$(MAKE) -f $(SRCDIR)/Makefile.$(PLATFORM) CONFIG=$(CONFIG) check
+bench:
+	$(MAKE) -f $(SRCDIR)/Makefile.$(PLATFORM) CONFIG=$(CONFIG) bench
 fullcheck:
 	$(MAKE) -f $(SRCDIR)/Makefile.$(PLATFORM) CONFIG=$(CONFIG) fullcheck
 dist:
diff --git a/distribution/manifest b/distribution/manifest
index c5b0989a..d0543f86 100644
--- a/distribution/manifest
+++ b/distribution/manifest
@@ -101,7 +101,10 @@ tests/compiler-tests-3.scm
 tests/inlining-tests.scm
 tests/locative-stress-test.scm
 tests/r4rstest.scm
+tests/null.scm
+tests/sgrep.scm
 tests/runtests.sh
+tests/runbench.sh
 tests/srfi-4-tests.scm
 tests/srfi-18-tests.scm
 tests/hash-table-tests.scm
diff --git a/rules.make b/rules.make
index 711485b7..c972e8fb 100644
--- a/rules.make
+++ b/rules.make
@@ -1045,6 +1045,13 @@ check: $(CHICKEN_SHARED_EXECUTABLE) $(CSI_SHARED_EXECUTABLE) $(CSC_PROGRAM)
 	cd tests; sh runtests.sh
 
 
+# benchmark
+
+.PHONY: bench
+
+bench: $(CHICKEN_SHARED_EXECUTABLE) $(CSI_SHARED_EXECUTABLE) $(CSC_PROGRAM)
+	cd tests; sh runbench.sh
+
 # 3-stage build
 
 .PHONY: stage1 stage2 stage3
@@ -1079,3 +1086,13 @@ stage3:
 	  SRCDIR=$(SRCDIR) CONFIG=$(CONFIG) \
 	  CHICKEN=./$(CHICKEN_PROGRAM)-stage2 \
 	  confclean clean all
+
+# build current head in suib-directory
+
+.PHONY: buildhead
+
+buildhead:
+	rm -fr chicken-`cat buildversion`
+	git archive --format=tar --prefix=chicken-`cat buildversion`/ HEAD | tar x
+	cd chicken-`cat buildversion`; $(MAKE) -f Makefile.$(PLATFORM) \
+	  PLATFORM=$(PLATFORM) PREFIX=`pwd` CONFIG= CHICKEN=../$(CHICKEN) all install
diff --git a/tests/null.scm b/tests/null.scm
new file mode 100644
index 00000000..7c003fbc
--- /dev/null
+++ b/tests/null.scm
@@ -0,0 +1,24 @@
+;;;; null.scm - the empty program
+;
+; Copyright (c) 2010, The Chicken Team
+; All rights reserved.
+;
+; Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
+; conditions are met:
+;
+;   Redistributions of source code must retain the above copyright notice, this list of conditions and the following
+;     disclaimer. 
+;   Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
+;     disclaimer in the documentation and/or other materials provided with the distribution. 
+;   Neither the name of the author nor the names of its contributors may be used to endorse or promote
+;     products derived from this software without specific prior written permission. 
+;
+; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
+; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+; AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
+; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+; POSSIBILITY OF SUCH DAMAGE.
diff --git a/tests/runbench.sh b/tests/runbench.sh
new file mode 100644
index 00000000..439c7a89
--- /dev/null
+++ b/tests/runbench.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+# runbench.sh - run benchmarks
+#
+# - Note: this needs a proper shell, so it will not work with plain mingw
+#   (just the compiler and the Windows shell, without MSYS)
+
+set -e
+TEST_DIR=`pwd`
+export DYLD_LIBRARY_PATH=${TEST_DIR}/..
+export LD_LIBRARY_PATH=${TEST_DIR}/..
+
+CHICKEN=../chicken
+
+if test -n "$MSYSTEM"; then
+    CHICKEN="..\\chicken.exe"
+    # make compiled tests use proper library on Windows
+    cp ../libchicken.dll .
+fi
+
+compiler_options="-C -Wa,-W"
+compile="../csc -compiler $CHICKEN -I.. -L.. -include-path .. -o a.out $compiler_options"
+run="/usr/bin/time -f '%E elapsed, $S CPU, %K memory, $M RSS' ./a.out"
+
+echo -n "null ... "
+$compile null.scm -O5
+$run
+
+echo -n "compiler ... "
+$compile compiler.scm -O5
+$run
+
+echo -n "slatex ... "
+$compile slatex.scm -O5
+mkdir -p slatexdir
+rm -f slatexdir/*
+$run
+
+echo -n "grep ... "
+$compile sgrep.scm -O5
+$run
+
+echo -n "fft/boxed ... "
+$compile fft.scm -O5
+$run
+echo -n "fft/unboxed ... "
+$compile fft.scm -O5 -D unboxed
+$run
Trap