~ chicken-core (chicken-5) 19d9512b56dad9fced297f4395544c8bb0e1bd40
commit 19d9512b56dad9fced297f4395544c8bb0e1bd40 Author: felix <bunny351@gmail.com> AuthorDate: Mon May 17 11:54:07 2010 +0200 Commit: felix <bunny351@gmail.com> CommitDate: Mon May 17 11:54:07 2010 +0200 removed cache code from sgrep test; time(1) options for bsd+mac (yawn) diff --git a/tests/runbench.sh b/tests/runbench.sh index 8ef122b9..e1e675f6 100644 --- a/tests/runbench.sh +++ b/tests/runbench.sh @@ -17,9 +17,15 @@ if test -n "$MSYSTEM"; then cp ../libchicken.dll . fi +case `uname -s` in + *BSD*|*bsd*) timeopts="-c";; + Darwin) timeopts="";; + *) timeopts="-f '%E elapsed, %U user, %S system'" +esac + run() { - /usr/bin/time -f '%E elapsed, %U user, %S system' ./a.out + /usr/bin/time $timeopts ./a.out } echo @@ -32,7 +38,7 @@ $compile null.scm -O5 run echo -n "compilation ... " -/usr/bin/time -f '%E elapsed, %U user, %S system' $compile compiler.scm -O5 +/usr/bin/time $timeopts $compile compiler.scm -O5 echo -n "compiler ... " run diff --git a/tests/sgrep.scm b/tests/sgrep.scm index 700584c9..7503256a 100644 --- a/tests/sgrep.scm +++ b/tests/sgrep.scm @@ -7,14 +7,6 @@ (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 () ((_ n expr) @@ -43,51 +35,6 @@ (syntax-rules () ((_) '(: #\( (submatch (* any)) ", " (submatch (* any)))))) -#| -(define the-cache) - -(define-syntax (build-cache x r c) - ;; (build-cache N ARG FAIL) - (let* ((n (cadr x)) - (n2 (* n 2)) - (arg (caddr x)) - (fail (cadddr x)) - (%cache (r 'cache)) - (%index (r 'index)) - (%arg (r 'arg)) - (%let (r 'let)) - (%let* (r 'let*)) - (%if (r 'if)) - (%fx+ (r 'fx+)) - (%fxmod (r 'fxmod)) - (%equal? (r 'equal?)) - (%quote (r 'quote)) - (%tmp (r 'tmp)) - (%begin (r 'begin)) - (cache (make-vector (add1 n2) #f))) - (vector-set! cache n2 0) - `(,%let* ((,%cache (,%quote ,cache)) - (,%arg ,arg)) - (set! the-cache ,%cache) ;XXX - ,(let fold ((i 0)) - (if (>= i n) - `(,%let ((,%tmp ,fail) - (,%index (##sys#slot ,%cache ,n2))) - (##sys#setslot ,%cache ,%index ,%arg) - (##sys#setslot ,%cache (,%fx+ ,%index 1) ,%tmp) - (##sys#setislot ,%cache ,n2 (,%fxmod (,%fx+ ,%index 2) ,n2)) - ,%tmp) - `(,%if (,%equal? (##sys#slot ,%cache ,(* i 2)) ,%arg) - (##sys#slot ,%cache ,(add1 (* i 2))) - ,(fold (add1 i)))))))) - -(define (regexp2 rx) - (build-cache - 5 rx - (regexp rx))) - -|# - ;; slow ;(print "literal") (bgrep 1 (rx1)) @@ -102,22 +49,6 @@ |# #| -(print "test cache fill") -(do ((lst (list-tabulate 10 number->string) (cdr lst))) - ((null? lst)) - (assert (string-match (regexp2 (car lst)) (car lst)))) -(print the-cache) - -(print "cached/literal") -(bgrep 1 (regexp2 (rx1))) - -(print the-cache) - -(print "cached/literal (SRE)") -(bgrep 1 (regexp2 (rx2))) - -(print the-cache) - (define-compiler-syntax (string-search x r c) (let ((%quote (r 'quote)) (%let (r 'let))Trap