2007-06-13 03:14:14 -04:00
|
|
|
|
|
|
|
(library (r6rs-benchmarks)
|
2007-06-13 10:49:54 -04:00
|
|
|
(export run-benchmark fatal-error include-source
|
|
|
|
call-with-output-file/truncate
|
2007-06-13 03:19:16 -04:00
|
|
|
ack-iters
|
2007-06-13 07:17:57 -04:00
|
|
|
array1-iters
|
|
|
|
boyer-iters
|
|
|
|
browse-iters
|
|
|
|
cat-iters
|
|
|
|
conform-iters
|
|
|
|
cpstak-iters
|
|
|
|
ctak-iters
|
|
|
|
dderiv-iters
|
|
|
|
deriv-iters
|
|
|
|
destruc-iters
|
|
|
|
diviter-iters
|
|
|
|
divrec-iters
|
|
|
|
dynamic-iters
|
|
|
|
earley-iters
|
2007-06-18 11:04:02 -04:00
|
|
|
fft-iters
|
2007-06-13 07:17:57 -04:00
|
|
|
fib-iters
|
|
|
|
fibc-iters
|
|
|
|
fibfp-iters
|
2007-06-13 10:49:54 -04:00
|
|
|
fpsum-iters
|
2007-06-13 07:17:57 -04:00
|
|
|
gcbench-iters
|
|
|
|
gcold-iters
|
|
|
|
graphs-iters
|
|
|
|
lattice-iters
|
|
|
|
matrix-iters
|
|
|
|
mazefun-iters
|
|
|
|
mbrot-iters
|
|
|
|
nboyer-iters
|
|
|
|
nqueens-iters
|
2007-06-13 11:17:21 -04:00
|
|
|
nucleic-iters
|
2007-06-13 07:17:57 -04:00
|
|
|
takl-iters
|
|
|
|
paraffins-iters
|
|
|
|
parsing-iters
|
|
|
|
perm9-iters
|
|
|
|
pnpoly-iters
|
|
|
|
peval-iters
|
2007-06-13 10:49:54 -04:00
|
|
|
pi-iters
|
|
|
|
primes-iters
|
|
|
|
puzzle-iters
|
|
|
|
quicksort-iters
|
2007-06-18 07:06:13 -04:00
|
|
|
ray-iters
|
2007-06-13 10:49:54 -04:00
|
|
|
sboyer-iters
|
2007-06-16 02:59:39 -04:00
|
|
|
simplex-iters
|
2007-06-13 10:49:54 -04:00
|
|
|
sum-iters
|
|
|
|
sum1-iters
|
|
|
|
string-iters
|
|
|
|
sumfp-iters
|
|
|
|
sumloop-iters
|
|
|
|
tail-iters
|
|
|
|
tak-iters
|
|
|
|
trav1-iters
|
|
|
|
trav2-iters
|
|
|
|
triangl-iters
|
|
|
|
wc-iters)
|
|
|
|
|
2007-06-13 03:14:14 -04:00
|
|
|
(import (ikarus))
|
2007-06-13 07:17:57 -04:00
|
|
|
|
2007-06-13 10:49:54 -04:00
|
|
|
(define call-with-output-file/truncate
|
|
|
|
(lambda (file-name proc)
|
|
|
|
(call-with-output-file file-name proc 'truncate)))
|
|
|
|
|
2007-06-13 07:17:57 -04:00
|
|
|
(define-syntax include-source
|
|
|
|
(lambda (x)
|
|
|
|
(syntax-case x ()
|
|
|
|
[(ctxt name)
|
|
|
|
(cons #'begin
|
|
|
|
(with-input-from-file
|
|
|
|
(format "r6rs-benchmarks/~a" (syntax->datum #'name))
|
|
|
|
(lambda ()
|
|
|
|
(let f ()
|
|
|
|
(let ([x (read)])
|
|
|
|
(cond
|
|
|
|
[(eof-object? x) '()]
|
|
|
|
[else
|
|
|
|
(cons (datum->syntax #'ctxt x) (f))]))))))])))
|
|
|
|
|
|
|
|
(define (fatal-error . args)
|
|
|
|
(error 'fatal-error "~a"
|
|
|
|
(apply (lambda (x) (format "~a" x)) args)))
|
2007-06-13 03:14:14 -04:00
|
|
|
|
|
|
|
(define (run-bench count run)
|
|
|
|
(unless (= count 0)
|
|
|
|
(let f ([count (- count 1)])
|
|
|
|
(cond
|
|
|
|
[(= count 0) (run)]
|
|
|
|
[else
|
|
|
|
(begin (run) (f (- count 1)))]))))
|
|
|
|
|
|
|
|
(define (run-benchmark name count ok? run-maker . args)
|
|
|
|
(let ([run (apply run-maker args)])
|
|
|
|
(let ([result
|
|
|
|
(time-it name
|
|
|
|
(lambda () (run-bench count run)))])
|
|
|
|
(unless (ok? result)
|
|
|
|
(error #f "*** wrong result ***")))))
|
|
|
|
|
|
|
|
|
|
|
|
; Gabriel benchmarks
|
|
|
|
(define boyer-iters 20)
|
|
|
|
(define browse-iters 600)
|
|
|
|
(define cpstak-iters 1000)
|
|
|
|
(define ctak-iters 100)
|
|
|
|
(define dderiv-iters 2000000)
|
|
|
|
(define deriv-iters 2000000)
|
|
|
|
(define destruc-iters 500)
|
|
|
|
(define diviter-iters 1000000)
|
|
|
|
(define divrec-iters 1000000)
|
|
|
|
(define puzzle-iters 100)
|
|
|
|
(define tak-iters 2000)
|
|
|
|
(define takl-iters 300)
|
|
|
|
(define trav1-iters 100)
|
|
|
|
(define trav2-iters 20)
|
|
|
|
(define triangl-iters 10)
|
|
|
|
; Kernighan and Van Wyk benchmarks
|
|
|
|
(define ack-iters 1)
|
|
|
|
(define array1-iters 1)
|
|
|
|
(define cat-iters 1)
|
|
|
|
(define string-iters 1)
|
|
|
|
(define sum1-iters 1)
|
|
|
|
(define sumloop-iters 1)
|
|
|
|
(define tail-iters 1)
|
|
|
|
(define wc-iters 1)
|
|
|
|
|
|
|
|
; C benchmarks
|
|
|
|
(define fft-iters 2000)
|
|
|
|
(define fib-iters 5)
|
|
|
|
(define fibfp-iters 2)
|
|
|
|
(define mbrot-iters 100)
|
|
|
|
(define nucleic-iters 5)
|
|
|
|
(define pnpoly-iters 100000)
|
|
|
|
(define sum-iters 10000)
|
|
|
|
(define sumfp-iters 5000)
|
|
|
|
(define tfib-iters 20)
|
|
|
|
|
|
|
|
; Other benchmarks
|
|
|
|
(define conform-iters 40)
|
|
|
|
(define dynamic-iters 20)
|
|
|
|
(define earley-iters 200)
|
|
|
|
(define fibc-iters 500)
|
|
|
|
(define graphs-iters 300)
|
|
|
|
(define lattice-iters 1)
|
|
|
|
(define matrix-iters 400)
|
|
|
|
(define maze-iters 4000)
|
|
|
|
(define mazefun-iters 1000)
|
|
|
|
(define nqueens-iters 2000)
|
|
|
|
(define paraffins-iters 1000)
|
|
|
|
(define peval-iters 200)
|
|
|
|
(define pi-iters 2)
|
|
|
|
(define primes-iters 100000)
|
|
|
|
(define ray-iters 5)
|
|
|
|
(define scheme-iters 20000)
|
|
|
|
(define simplex-iters 100000)
|
|
|
|
(define slatex-iters 20)
|
|
|
|
(define perm9-iters 10)
|
|
|
|
(define nboyer-iters 100)
|
|
|
|
(define sboyer-iters 100)
|
|
|
|
(define gcbench-iters 1)
|
|
|
|
(define compiler-iters 300)
|
|
|
|
|
|
|
|
; New benchmarks
|
|
|
|
(define parsing-iters 1000)
|
|
|
|
(define gcold-iters 10000)
|
2007-06-13 10:49:54 -04:00
|
|
|
|
|
|
|
(define quicksort-iters 1)
|
|
|
|
(define fpsum-iters 10)
|
2007-06-13 03:14:14 -04:00
|
|
|
;(define nbody-iters 1) ; nondeterministic (order of evaluation)
|
|
|
|
)
|
|
|
|
|