* Added new r6rs benchmarks folder.

This commit is contained in:
Abdulaziz Ghuloum 2007-06-13 10:14:14 +03:00
parent 9bd65cc447
commit 681ec55067
5 changed files with 150 additions and 1 deletions

19
benchmarks/new/bench.ss Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env ikarus --r6rs-script
(import
(ikarus)
(r6rs-benchmarks))
(define (run name)
(eval '(main) (environment (list 'r6rs-benchmarks name))))
(apply
(case-lambda
[(script-name bench-name)
(run (string->symbol bench-name))]
[(script-name . args)
(error script-name
(if (null? args)
"missing benchmark name"
"too many arguments"))])
(command-line-arguments))

View File

@ -0,0 +1,90 @@
(library (r6rs-benchmarks)
(export run-benchmark fib-iters)
(import (ikarus))
(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)
;(define nbody-iters 1) ; nondeterministic (order of evaluation)
)

View File

@ -0,0 +1,20 @@
;;; FIB -- A classic benchmark, computes fib(35) inefficiently.
(library (r6rs-benchmarks fib)
(export main)
(import (r6rs) (r6rs-benchmarks))
(define (fib n)
(if (< n 2)
n
(+ (fib (- n 1))
(fib (- n 2)))))
(define (main . args)
(run-benchmark
"fib"
fib-iters
(lambda (result) (equal? result 9227465))
(lambda (n) (lambda () (fib n)))
35)))

View File

@ -8,7 +8,7 @@
; (printf "[~s] compiling \n" (depth))
; (pretty-print x)
; (alt-compile x))))
(current-eval alt-compile)
;(current-eval alt-compile)
(define (run-bench name count ok? run)
(let loop ((i 0) (result (list 'undefined)))

View File

@ -5540,3 +5540,23 @@ Words allocated: 100923902
Words reclaimed: 0
Elapsed time...: 6575 ms (User: 6505 ms; System: 70 ms)
Elapsed GC time: 276 ms (CPU: 293 in 385 collections.)
****************************
Benchmarking Larceny-r6rs on Wed Jun 13 10:04:10 AST 2007 under Darwin Vesuvius.local 8.9.1 Darwin Kernel Version 8.9.1: Thu Feb 22 20:55:00 PST 2007; root:xnu-792.18.15~1/RELEASE_I386 i386 i386
Testing fib under Larceny-r6rs
Compiling...
Larceny v0.93 "Deviated Prevert" (Nov 10 2006 04:27:45, precise:BSD Unix:unified)
>
>
Running...
Larceny v0.93 "Deviated Prevert" (Nov 10 2006 04:27:45, precise:BSD Unix:unified)
>
Words allocated: 0
Words reclaimed: 0
Elapsed time...: 1795 ms (User: 1781 ms; System: 4 ms)
Elapsed GC time: 0 ms (CPU: 0 in 0 collections.)