~ chicken-core (chicken-5) 6da902a362718e8b6a40c16103943f90f74d4d21
commit 6da902a362718e8b6a40c16103943f90f74d4d21 Author: felix <felix@call-with-current-continuation.org> AuthorDate: Fri May 14 14:14:59 2010 +0200 Commit: felix <felix@call-with-current-continuation.org> CommitDate: Fri May 14 14:14:59 2010 +0200 benchmark tweaking diff --git a/rules.make b/rules.make index c972e8fb..db2b66f6 100644 --- a/rules.make +++ b/rules.make @@ -1050,7 +1050,7 @@ check: $(CHICKEN_SHARED_EXECUTABLE) $(CSI_SHARED_EXECUTABLE) $(CSC_PROGRAM) .PHONY: bench bench: $(CHICKEN_SHARED_EXECUTABLE) $(CSI_SHARED_EXECUTABLE) $(CSC_PROGRAM) - cd tests; sh runbench.sh + cd tests; date >>bench.log; sh runbench.sh | tee -a bench-log # 3-stage build diff --git a/tests/fft.scm b/tests/fft.scm index 53332f47..e8590895 100644 --- a/tests/fft.scm +++ b/tests/fft.scm @@ -2059,7 +2059,7 @@ (expt 2 n)) (table (make-w (fx- n 1)))) - (display (fx* two^n 2))(newline) + ;(display (fx* two^n 2))(newline) (let ((a (make-f64vector (fx* two^n 2) 0.))) (do ((i 0 (fx+ i 1))) diff --git a/tests/runbench.sh b/tests/runbench.sh index 439c7a89..f02e06d1 100644 --- a/tests/runbench.sh +++ b/tests/runbench.sh @@ -17,31 +17,35 @@ if test -n "$MSYSTEM"; then cp ../libchicken.dll . fi +run() +{ + /usr/bin/time -f '%E elapsed, %U user, %S system' ./a.out +} + 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" +compile="../csc -w -compiler $CHICKEN -I.. -L.. -include-path .. -o a.out $compiler_options" echo -n "null ... " $compile null.scm -O5 -$run +run echo -n "compiler ... " $compile compiler.scm -O5 -$run +run echo -n "slatex ... " $compile slatex.scm -O5 mkdir -p slatexdir rm -f slatexdir/* -$run +run echo -n "grep ... " $compile sgrep.scm -O5 -$run +run echo -n "fft/boxed ... " $compile fft.scm -O5 -$run +run echo -n "fft/unboxed ... " $compile fft.scm -O5 -D unboxed -$run +run diff --git a/tests/sgrep.scm b/tests/sgrep.scm index b88890c2..700584c9 100644 --- a/tests/sgrep.scm +++ b/tests/sgrep.scm @@ -7,11 +7,13 @@ (define big-string (read-all (optional (command-line-arguments) "compiler.scm"))) +#| ;; hack for missing safe variants of fxmod (define-compiler-syntax fxmod (syntax-rules () ((_ x y) (##core#inline "C_fixnum_modulo" x y)))) +|# (define-syntax bgrep (syntax-rules () @@ -26,13 +28,22 @@ (scan-input-lines (lambda (line) (set! c (fx+ c 1)) - (when (zero? (fxmod c 100)) (print* ".")) + ;(when (zero? (fxmod c 500)) (print* ".")) (when (string-search expr line) (set! h (fx+ h 1))) #f)) - (newline) + ;(newline) h)))))))) +(define-syntax rx1 + (syntax-rules () + ((_) "\\((.*), (.*)\\)"))) + +(define-syntax rx2 + (syntax-rules () + ((_) '(: #\( (submatch (* any)) ", " (submatch (* any)))))) + +#| (define the-cache) (define-syntax (build-cache x r c) @@ -70,32 +81,27 @@ (##sys#slot ,%cache ,(add1 (* i 2))) ,(fold (add1 i)))))))) -(define-syntax rx1 - (syntax-rules () - ((_) "\\((.*), (.*)\\)"))) - -(define-syntax rx2 - (syntax-rules () - ((_) '(: #\( (submatch (* any)) ", " (submatch (* any)))))) - (define (regexp2 rx) (build-cache 5 rx (regexp rx))) -#| +|# + ;; slow -(print "baseline/literal") +;(print "literal") (bgrep 1 (rx1)) -(print "baseline/literal (SRE)") +#| +(print "literal (SRE)") (bgrep 1 (rx2)) -|# -(print "baseline/precompiled") +(print "precompiled") (define rx (regexp (rx1))) (bgrep 1 rx) +|# +#| (print "test cache fill") (do ((lst (list-tabulate 10 number->string) (cdr lst))) ((null? lst)) @@ -140,4 +146,6 @@ (print "inline cached/literal (SRE)") (bgrep 1 '(: #\( (submatch (* any)) ", " (submatch (* any)))) +|# +Trap