* Fixed benchmarks to work on (rnrs) libraries instead of the old
(r6rs) libraries.
This commit is contained in:
parent
6348eb9918
commit
ab282428fe
|
@ -1,14 +1,13 @@
|
|||
* maze needs bitwise-and
|
||||
* quicksort needs bignum modulo.
|
||||
* scheme needs complex? and other stuff.
|
||||
* compiler needs string-downcase
|
||||
* nbody needs real-part
|
||||
* nbody needs real-part, make-polar
|
||||
|
||||
* ntakl kinda slow
|
||||
* string too slow
|
||||
* nbody does not work
|
||||
|
||||
* fibfp does not terminate
|
||||
* fibfp does not terminate (not anymore)
|
||||
* mbrot too slow
|
||||
* pnpoly kinda slow
|
||||
* sumfp/fpsum too slow
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
(lambda ()
|
||||
(eval 'main
|
||||
(environment
|
||||
(list 'r6rs-benchmarks name)))))])
|
||||
(list 'rnrs-benchmarks name)))))])
|
||||
(proc)))
|
||||
|
||||
(apply
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
|
||||
(library (r6rs-benchmarks dynamic)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs mutable-pairs) (r6rs-benchmarks))
|
||||
(include-source "dynamic.src.ss"))
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
(library (r6rs-benchmarks)
|
||||
(library (rnrs-benchmarks)
|
||||
(export run-benchmark fatal-error include-source
|
||||
call-with-output-file/truncate
|
||||
ack-iters
|
||||
|
@ -27,8 +27,10 @@
|
|||
graphs-iters
|
||||
lattice-iters
|
||||
matrix-iters
|
||||
maze-iters
|
||||
mazefun-iters
|
||||
mbrot-iters
|
||||
nbody-iters
|
||||
nboyer-iters
|
||||
nqueens-iters
|
||||
nucleic-iters
|
||||
|
@ -44,6 +46,7 @@
|
|||
quicksort-iters
|
||||
ray-iters
|
||||
sboyer-iters
|
||||
scheme-iters
|
||||
simplex-iters
|
||||
slatex-iters
|
||||
sum-iters
|
||||
|
@ -168,6 +171,6 @@
|
|||
|
||||
(define quicksort-iters 1)
|
||||
(define fpsum-iters 10)
|
||||
;(define nbody-iters 1) ; nondeterministic (order of evaluation)
|
||||
(define nbody-iters 1) ; nondeterministic (order of evaluation)
|
||||
)
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
;;; ACK -- One of the Kernighan and Van Wyk benchmarks.
|
||||
|
||||
(library (r6rs-benchmarks ack)
|
||||
(library (rnrs-benchmarks ack)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define (ack m n)
|
||||
(cond ((= m 0) (+ n 1))
|
|
@ -1,8 +1,8 @@
|
|||
;;; ARRAY1 -- One of the Kernighan and Van Wyk benchmarks.
|
||||
|
||||
(library (r6rs-benchmarks array1)
|
||||
(library (rnrs-benchmarks array1)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define (create-x n)
|
||||
(define result (make-vector n))
|
|
@ -1,11 +1,11 @@
|
|||
;;; BOYER -- Logic programming benchmark, originally written by Bob Boyer.
|
||||
;;; Fairly CONS intensive.
|
||||
|
||||
(library (r6rs-benchmarks boyer)
|
||||
(library (rnrs-benchmarks boyer)
|
||||
(export main)
|
||||
(import (r6rs)
|
||||
(r6rs mutable-pairs)
|
||||
(r6rs-benchmarks))
|
||||
(import (rnrs)
|
||||
(rnrs mutable-pairs)
|
||||
(rnrs-benchmarks))
|
||||
|
||||
(define (lookup key table)
|
||||
(let loop ((x table))
|
|
@ -1,11 +1,11 @@
|
|||
;;; BROWSE -- Benchmark to create and browse through
|
||||
;;; an AI-like data base of units.
|
||||
|
||||
(library (r6rs-benchmarks browse)
|
||||
(library (rnrs-benchmarks browse)
|
||||
(export main)
|
||||
(import (r6rs)
|
||||
(r6rs mutable-pairs)
|
||||
(r6rs-benchmarks))
|
||||
(import (rnrs)
|
||||
(rnrs mutable-pairs)
|
||||
(rnrs-benchmarks))
|
||||
|
||||
(define (lookup key table)
|
||||
(let loop ((x table))
|
|
@ -1,8 +1,8 @@
|
|||
;;; CAT -- One of the Kernighan and Van Wyk benchmarks.
|
||||
|
||||
(library (r6rs-benchmarks cat)
|
||||
(library (rnrs-benchmarks cat)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define inport #f)
|
||||
(define outport #f)
|
|
@ -1,8 +1,8 @@
|
|||
;(define integer->char ascii->char)
|
||||
;(define char->integer char->ascii)
|
||||
(library (r6rs-benchmarks compiler)
|
||||
(library (rnrs-benchmarks compiler)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs mutable-pairs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs mutable-pairs) (rnrs-benchmarks))
|
||||
|
||||
(define open-input-file* open-input-file)
|
||||
(define (pp-expression expr port) (write expr port) (newline port))
|
|
@ -1,11 +1,11 @@
|
|||
;;; CONFORM -- Type checker, written by Jim Miller.
|
||||
|
||||
(library (r6rs-benchmarks conform)
|
||||
(library (rnrs-benchmarks conform)
|
||||
(export main)
|
||||
(import (r6rs)
|
||||
(r6rs unicode)
|
||||
(r6rs mutable-pairs)
|
||||
(r6rs-benchmarks))
|
||||
(import (rnrs)
|
||||
(rnrs unicode)
|
||||
(rnrs mutable-pairs)
|
||||
(rnrs-benchmarks))
|
||||
|
||||
;;; Functional and unstable
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
;;; CPSTAK -- A continuation-passing version of the TAK benchmark.
|
||||
;;; A good test of first class procedures and tail recursion.
|
||||
|
||||
(library (r6rs-benchmarks cpstak)
|
||||
(library (rnrs-benchmarks cpstak)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define (cpstak x y z)
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
;;; CTAK -- A version of the TAK procedure that uses continuations.
|
||||
|
||||
(library (r6rs-benchmarks ctak)
|
||||
(library (rnrs-benchmarks ctak)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define (ctak x y z)
|
||||
(call-with-current-continuation
|
|
@ -3,9 +3,9 @@
|
|||
;;; Returns the wrong answer for quotients.
|
||||
;;; Fortunately these aren't used in the benchmark.
|
||||
|
||||
(library (r6rs-benchmarks dderiv)
|
||||
(library (rnrs-benchmarks dderiv)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs mutable-pairs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs mutable-pairs) (rnrs-benchmarks))
|
||||
|
||||
(define (lookup key table)
|
||||
(let loop ((x table))
|
|
@ -1,8 +1,8 @@
|
|||
;;; DERIV -- Symbolic derivation.
|
||||
|
||||
(library (r6rs-benchmarks deriv)
|
||||
(library (rnrs-benchmarks deriv)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
;;; Returns the wrong answer for quotients.
|
||||
;;; Fortunately these aren't used in the benchmark.
|
|
@ -1,10 +1,10 @@
|
|||
;;; DESTRUC -- Destructive operation benchmark.
|
||||
|
||||
(library (r6rs-benchmarks destruc)
|
||||
(library (rnrs-benchmarks destruc)
|
||||
(export main)
|
||||
(import (r6rs)
|
||||
(r6rs mutable-pairs)
|
||||
(r6rs-benchmarks))
|
||||
(import (rnrs)
|
||||
(rnrs mutable-pairs)
|
||||
(rnrs-benchmarks))
|
||||
|
||||
(define (append-to-tail! x y)
|
||||
(if (null? x)
|
|
@ -1,8 +1,8 @@
|
|||
;;; DIVITER -- Benchmark which divides by 2 using lists of n ()'s.
|
||||
|
||||
(library (r6rs-benchmarks diviter)
|
||||
(library (rnrs-benchmarks diviter)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define (create-n n)
|
||||
(do ((n n (- n 1))
|
|
@ -1,8 +1,8 @@
|
|||
;;; DIVREC -- Benchmark which divides by 2 using lists of n ()'s.
|
||||
|
||||
(library (r6rs-benchmarks divrec)
|
||||
(library (rnrs-benchmarks divrec)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define (create-n n)
|
||||
(do ((n n (- n 1))
|
|
@ -2306,7 +2306,7 @@
|
|||
(define doit
|
||||
(lambda ()
|
||||
(i!)
|
||||
(let ((foo (dynamic-parse-file "r6rs-benchmarks/dynamic.src.ss")))
|
||||
(let ((foo (dynamic-parse-file "rnrs-benchmarks/dynamic.src.ss")))
|
||||
(normalize-global-constraints!)
|
||||
(reset-counters!)
|
||||
(tag-ast*-show foo)
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
(library (rnrs-benchmarks dynamic)
|
||||
(export main)
|
||||
(import (rnrs) (rnrs mutable-pairs) (rnrs-benchmarks))
|
||||
(include-source "dynamic.src.ss"))
|
|
@ -123,9 +123,9 @@
|
|||
; Enders of V = (5 19 20)
|
||||
; Predictors of V = (15 17)
|
||||
|
||||
(library (r6rs-benchmarks earley)
|
||||
(library (rnrs-benchmarks earley)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define (make-parser grammar lexer)
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
;;; FFT - Fast Fourier Transform, translated from "Numerical Recipes in C"
|
||||
|
||||
(library (r6rs-benchmarks fft)
|
||||
(library (rnrs-benchmarks fft)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs arithmetic flonums) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs arithmetic flonums) (rnrs-benchmarks))
|
||||
|
||||
;(define flsin sin)
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
;;; FIB -- A classic benchmark, computes fib(35) inefficiently.
|
||||
|
||||
(library (r6rs-benchmarks fib)
|
||||
(library (rnrs-benchmarks fib)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define (fib n)
|
||||
(if (< n 2)
|
|
@ -1,8 +1,8 @@
|
|||
;;; FIBC -- FIB using first-class continuations, written by Kent Dybvig
|
||||
|
||||
(library (r6rs-benchmarks fibc)
|
||||
(library (rnrs-benchmarks fibc)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define (_1+ n) (+ n 1))
|
||||
(define (_1- n) (- n 1))
|
|
@ -1,10 +1,10 @@
|
|||
;;; FIBFP -- Computes fib(35) using floating point
|
||||
|
||||
(library (r6rs-benchmarks fibfp)
|
||||
(library (rnrs-benchmarks fibfp)
|
||||
(export main)
|
||||
(import (r6rs)
|
||||
(r6rs arithmetic flonums)
|
||||
(r6rs-benchmarks))
|
||||
(import (rnrs)
|
||||
(rnrs arithmetic flonums)
|
||||
(rnrs-benchmarks))
|
||||
|
||||
(define (fibfp n)
|
||||
(if (fl<? n 2.)
|
|
@ -1,8 +1,8 @@
|
|||
;;; FPSUM - Compute sum of integers from 0 to 1e6 using floating point
|
||||
|
||||
(library (r6rs-benchmarks fpsum)
|
||||
(library (rnrs-benchmarks fpsum)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs arithmetic flonums) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs arithmetic flonums) (rnrs-benchmarks))
|
||||
|
||||
(define (run)
|
||||
(let loop ((i 1e6) (n 0.))
|
|
@ -33,9 +33,9 @@
|
|||
; of free memory. There is no portable way to do this in Scheme; each
|
||||
; implementation needs its own version.
|
||||
|
||||
(library (r6rs-benchmarks gcbench)
|
||||
(library (rnrs-benchmarks gcbench)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs arithmetic flonums) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs arithmetic flonums) (rnrs-benchmarks))
|
||||
|
||||
(define (run-benchmark2 name thunk)
|
||||
(display name)
|
|
@ -8,9 +8,9 @@
|
|||
|
||||
; Should be good enough for this benchmark.
|
||||
|
||||
(library (r6rs-benchmarks gcold)
|
||||
(library (rnrs-benchmarks gcold)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define (newRandom)
|
||||
(letrec ((random14
|
|
@ -1,8 +1,8 @@
|
|||
;;; GRAPHS -- Obtained from Andrew Wright.
|
||||
|
||||
(library (r6rs-benchmarks graphs)
|
||||
(library (rnrs-benchmarks graphs)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
;;; ==== util.ss ====
|
||||
|
||||
|
@ -59,7 +59,7 @@
|
|||
((= i len)
|
||||
state)))))
|
||||
|
||||
; AZIZ: r6rs has vector-map, this is not even used
|
||||
; AZIZ: rnrs has vector-map, this is not even used
|
||||
;(define vector-map
|
||||
; (lambda (vec proc)
|
||||
; (proc->vector (vector-length vec)
|
|
@ -1,8 +1,8 @@
|
|||
;;; LATTICE -- Obtained from Andrew Wright.
|
||||
|
||||
(library (r6rs-benchmarks lattice)
|
||||
(library (rnrs-benchmarks lattice)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs mutable-pairs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs mutable-pairs) (rnrs-benchmarks))
|
||||
|
||||
; Given a comparison routine that returns one of
|
||||
; less
|
|
@ -1,8 +1,8 @@
|
|||
;;; MATRIX -- Obtained from Andrew Wright.
|
||||
|
||||
(library (r6rs-benchmarks matrix)
|
||||
(library (rnrs-benchmarks matrix)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs mutable-pairs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs mutable-pairs) (rnrs-benchmarks))
|
||||
; Chez-Scheme compatibility stuff:
|
||||
|
||||
(define (chez-box x) (cons x '()))
|
|
@ -10,9 +10,9 @@
|
|||
|
||||
;;; Rehacked by Olin 4/1995.
|
||||
|
||||
(library (r6rs-benchmarks maze)
|
||||
(library (rnrs-benchmarks maze)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs mutable-pairs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs mutable-pairs) (rnrs-benchmarks))
|
||||
|
||||
(define (random-state n)
|
||||
(cons n #f))
|
|
@ -1,9 +1,9 @@
|
|||
;;; MAZEFUN -- Constructs a maze in a purely functional way,
|
||||
;;; written by Marc Feeley.
|
||||
|
||||
(library (r6rs-benchmarks mazefun)
|
||||
(library (rnrs-benchmarks mazefun)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define foldr
|
||||
(lambda (f base lst)
|
|
@ -1,8 +1,8 @@
|
|||
;;; MBROT -- Generation of Mandelbrot set fractal.
|
||||
|
||||
(library (r6rs-benchmarks mbrot)
|
||||
(library (rnrs-benchmarks mbrot)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs arithmetic flonums) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs arithmetic flonums) (rnrs-benchmarks))
|
||||
|
||||
(define (count r i step x y)
|
||||
|
|
@ -4,13 +4,13 @@
|
|||
; and added nbody-benchmark.
|
||||
; 981116 / wdc Replaced nbody-benchmark by main, added apply:+.
|
||||
|
||||
(library (r6rs-benchmarks nbody)
|
||||
(library (rnrs-benchmarks nbody)
|
||||
(export main)
|
||||
(import
|
||||
(r6rs)
|
||||
(r6rs arithmetic flonums)
|
||||
(r6rs mutable-pairs)
|
||||
(r6rs-benchmarks))
|
||||
(rnrs)
|
||||
(rnrs arithmetic flonums)
|
||||
(rnrs mutable-pairs)
|
||||
(rnrs-benchmarks))
|
||||
|
||||
(define void
|
||||
(let ((invisible (string->symbol "")))
|
|
@ -54,9 +54,9 @@
|
|||
; The second phase creates the test problem, and tests to see
|
||||
; whether it is implied by the lemmas.
|
||||
|
||||
(library (r6rs-benchmarks nboyer)
|
||||
(library (rnrs-benchmarks nboyer)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define (main . args)
|
||||
(let ((n (if (null? args) 0 (car args))))
|
|
@ -1,8 +1,8 @@
|
|||
;;; NQUEENS -- Compute number of solutions to 8-queens problem.
|
||||
|
||||
(library (r6rs-benchmarks nqueens)
|
||||
(library (rnrs-benchmarks nqueens)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define trace? #f)
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
;;; NTAKL -- The TAKeuchi function using lists as counters,
|
||||
;;; with an alternative boolean expression.
|
||||
|
||||
(library (r6rs-benchmarks ntakl)
|
||||
(library (rnrs-benchmarks ntakl)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define (listn n)
|
||||
(if (= n 0)
|
|
@ -18,12 +18,12 @@
|
|||
|
||||
; -- MATH UTILITIES -----------------------------------------------------------
|
||||
|
||||
(library (r6rs-benchmarks nucleic)
|
||||
(library (rnrs-benchmarks nucleic)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs arithmetic flonums) (r6rs-benchmarks))
|
||||
(define FLOATatan atan)
|
||||
(define FLOATcos cos)
|
||||
(define FLOATsin sin)
|
||||
(import (rnrs) (rnrs arithmetic flonums) (rnrs-benchmarks))
|
||||
(define FLOATatan flatan)
|
||||
(define FLOATcos flcos)
|
||||
(define FLOATsin flsin)
|
||||
(define-syntax nuc-const
|
||||
(syntax-rules ()
|
||||
[(_ x* ...) '#(x* ...)]))
|
|
@ -1,8 +1,8 @@
|
|||
;;; PARAFFINS -- Compute how many paraffins exist with N carbon atoms.
|
||||
|
||||
(library (r6rs-benchmarks paraffins)
|
||||
(library (rnrs-benchmarks paraffins)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define (gen n)
|
||||
(let* ((n/2 (quotient n 2))
|
|
@ -20,9 +20,9 @@
|
|||
;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(library (r6rs-benchmarks parsing)
|
||||
(library (rnrs-benchmarks parsing)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define (parsing-benchmark . rest)
|
||||
(let* ((n (if (null? rest) 1000 (car rest)))
|
|
@ -33,9 +33,9 @@
|
|||
; To: will
|
||||
; Subject: Pancake flips
|
||||
|
||||
(library (r6rs-benchmarks perm9)
|
||||
(library (rnrs-benchmarks perm9)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
; Procedure P_n generates a grey code of all perms of n elements
|
||||
; on top of stack ending with reversal of starting sequence
|
|
@ -1,8 +1,8 @@
|
|||
;;; PEVAL -- A simple partial evaluator for Scheme, written by Marc Feeley.
|
||||
|
||||
(library (r6rs-benchmarks peval)
|
||||
(library (rnrs-benchmarks peval)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs mutable-pairs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs mutable-pairs) (rnrs-benchmarks))
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
; See http://mathworld.wolfram.com/Pi.html for the various algorithms.
|
||||
|
||||
(library (r6rs-benchmarks pi)
|
||||
(library (rnrs-benchmarks pi)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
; Utilities.
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
;;; PNPOLY - Test if a point is contained in a 2D polygon.
|
||||
|
||||
(library (r6rs-benchmarks pnpoly)
|
||||
(library (rnrs-benchmarks pnpoly)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs arithmetic flonums) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs arithmetic flonums) (rnrs-benchmarks))
|
||||
|
||||
(define (pt-in-poly2 xp yp x y)
|
||||
(let loop ((c #f) (i (- (vector-length xp) 1)) (j 0))
|
|
@ -1,8 +1,8 @@
|
|||
;;; PRIMES -- Compute primes less than 100, written by Eric Mohr.
|
||||
|
||||
(library (r6rs-benchmarks primes)
|
||||
(library (rnrs-benchmarks primes)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define (interval-list m n)
|
||||
(if (> m n)
|
|
@ -1,8 +1,8 @@
|
|||
;;; PUZZLE -- Forest Baskett's Puzzle benchmark, originally written in Pascal.
|
||||
|
||||
(library (r6rs-benchmarks puzzle)
|
||||
(library (rnrs-benchmarks puzzle)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define (my-iota n)
|
||||
(do ((n n (- n 1))
|
|
@ -1,9 +1,9 @@
|
|||
; The quick-1 benchmark. (Figure 35, page 132.)
|
||||
|
||||
|
||||
(library (r6rs-benchmarks quicksort)
|
||||
(library (rnrs-benchmarks quicksort)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs mutable-pairs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs mutable-pairs) (rnrs-benchmarks))
|
||||
|
||||
(define (quick-1 v less?)
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
;;; RAY -- Ray-trace a simple scene with spheres, generating a ".pgm" file.
|
||||
;;; Translated to Scheme from Paul Graham's book ANSI Common Lisp, Example 9.8
|
||||
|
||||
(library (r6rs-benchmarks ray)
|
||||
(library (rnrs-benchmarks ray)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs arithmetic flonums) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs arithmetic flonums) (rnrs-benchmarks))
|
||||
|
||||
(define (make-point x y z)
|
||||
(vector x y z))
|
|
@ -55,9 +55,9 @@
|
|||
; The second phase creates the test problem, and tests to see
|
||||
; whether it is implied by the lemmas.
|
||||
|
||||
(library (r6rs-benchmarks sboyer)
|
||||
(library (rnrs-benchmarks sboyer)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define (main . args)
|
||||
(let ((n (if (null? args) 0 (car args))))
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
(library (r6rs-benchmarks scheme)
|
||||
(library (rnrs-benchmarks scheme)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs mutable-pairs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs mutable-pairs) (rnrs-benchmarks))
|
||||
|
||||
(define (scheme-eval expr)
|
||||
(let ((code (scheme-comp expr scheme-global-environment)))
|
||||
|
@ -860,6 +860,46 @@
|
|||
(scheme-global-var name)
|
||||
value))
|
||||
|
||||
|
||||
(define (main . args)
|
||||
(run-benchmark
|
||||
"scheme"
|
||||
scheme-iters
|
||||
(lambda (result)
|
||||
(equal? result
|
||||
'("eight" "eleven" "five" "four" "nine" "one"
|
||||
"seven" "six" "ten" "three" "twelve" "two")))
|
||||
(lambda (expr) (lambda () (scheme-eval expr)))
|
||||
'(let ()
|
||||
|
||||
(define (sort-list obj pred)
|
||||
|
||||
(define (loop l)
|
||||
(if (and (pair? l) (pair? (cdr l)))
|
||||
(split l '() '())
|
||||
l))
|
||||
|
||||
(define (split l one two)
|
||||
(if (pair? l)
|
||||
(split (cdr l) two (cons (car l) one))
|
||||
(merge (loop one) (loop two))))
|
||||
|
||||
(define (merge one two)
|
||||
(cond ((null? one) two)
|
||||
((pred (car two) (car one))
|
||||
(cons (car two)
|
||||
(merge (cdr two) one)))
|
||||
(else
|
||||
(cons (car one)
|
||||
(merge (cdr one) two)))))
|
||||
|
||||
(loop obj))
|
||||
|
||||
(sort-list '("one" "two" "three" "four" "five" "six"
|
||||
"seven" "eight" "nine" "ten" "eleven" "twelve")
|
||||
string<?))))
|
||||
|
||||
|
||||
(def-proc 'not (lambda (x) (not x)))
|
||||
(def-proc 'boolean? boolean?)
|
||||
(def-proc 'eqv? eqv?)
|
||||
|
@ -1040,40 +1080,4 @@
|
|||
|
||||
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
(define (main . args)
|
||||
(run-benchmark
|
||||
"scheme"
|
||||
scheme-iters
|
||||
(lambda (result)
|
||||
(equal? result
|
||||
'("eight" "eleven" "five" "four" "nine" "one"
|
||||
"seven" "six" "ten" "three" "twelve" "two")))
|
||||
(lambda (expr) (lambda () (scheme-eval expr)))
|
||||
'(let ()
|
||||
|
||||
(define (sort-list obj pred)
|
||||
|
||||
(define (loop l)
|
||||
(if (and (pair? l) (pair? (cdr l)))
|
||||
(split l '() '())
|
||||
l))
|
||||
|
||||
(define (split l one two)
|
||||
(if (pair? l)
|
||||
(split (cdr l) two (cons (car l) one))
|
||||
(merge (loop one) (loop two))))
|
||||
|
||||
(define (merge one two)
|
||||
(cond ((null? one) two)
|
||||
((pred (car two) (car one))
|
||||
(cons (car two)
|
||||
(merge (cdr two) one)))
|
||||
(else
|
||||
(cons (car one)
|
||||
(merge (cdr one) two)))))
|
||||
|
||||
(loop obj))
|
||||
|
||||
(sort-list '("one" "two" "three" "four" "five" "six"
|
||||
"seven" "eight" "nine" "ten" "eleven" "twelve")
|
||||
string<?)))))
|
||||
)
|
|
@ -1,8 +1,8 @@
|
|||
;;; SIMPLEX -- Simplex algorithm.
|
||||
|
||||
(library (r6rs-benchmarks simplex)
|
||||
(library (rnrs-benchmarks simplex)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs arithmetic flonums) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs arithmetic flonums) (rnrs-benchmarks))
|
||||
|
||||
(define (matrix-rows a) (vector-length a))
|
||||
(define (matrix-columns a) (vector-length (vector-ref a 0)))
|
|
@ -4,14 +4,14 @@
|
|||
;This file is compatible for the dialect other
|
||||
;(c) Dorai Sitaram, Rice U., 1991, 1994
|
||||
|
||||
(library (r6rs-benchmarks slatex)
|
||||
(library (rnrs-benchmarks slatex)
|
||||
(export main)
|
||||
(import
|
||||
(r6rs)
|
||||
(r6rs unicode)
|
||||
(r6rs mutable-pairs)
|
||||
(r6rs i/o simple)
|
||||
(r6rs-benchmarks))
|
||||
(rnrs)
|
||||
(rnrs unicode)
|
||||
(rnrs mutable-pairs)
|
||||
(rnrs i/o simple)
|
||||
(rnrs-benchmarks))
|
||||
|
||||
(define *op-sys* 'unix)
|
||||
|
||||
|
@ -2345,4 +2345,4 @@
|
|||
slatex-iters
|
||||
(lambda (result) #t)
|
||||
(lambda (filename) (lambda () (slatex.process-main-tex-file filename)))
|
||||
"r6rs-benchmarks/slatex-data/test")))
|
||||
"rnrs-benchmarks/slatex-data/test")))
|
|
@ -1,8 +1,8 @@
|
|||
;;; STRING -- One of the Kernighan and Van Wyk benchmarks.
|
||||
|
||||
(library (r6rs-benchmarks string)
|
||||
(library (rnrs-benchmarks string)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define s "abcdef")
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
;;; SUM -- Compute sum of integers from 0 to 10000
|
||||
|
||||
(library (r6rs-benchmarks sum)
|
||||
(library (rnrs-benchmarks sum)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define (run n)
|
||||
(let loop ((i n) (sum 0))
|
|
@ -1,8 +1,8 @@
|
|||
;;; SUM1 -- One of the Kernighan and Van Wyk benchmarks.
|
||||
|
||||
(library (r6rs-benchmarks sum1)
|
||||
(library (rnrs-benchmarks sum1)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs arithmetic flonums) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs arithmetic flonums) (rnrs-benchmarks))
|
||||
|
||||
(define inport #f)
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
;;; SUMFP -- Compute sum of integers from 0 to 10000 using floating point
|
||||
(library (r6rs-benchmarks sumfp)
|
||||
(library (rnrs-benchmarks sumfp)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs arithmetic flonums) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs arithmetic flonums) (rnrs-benchmarks))
|
||||
|
||||
|
||||
(define (run n)
|
|
@ -1,8 +1,8 @@
|
|||
;;; SUMLOOP -- One of the Kernighan and Van Wyk benchmarks.
|
||||
|
||||
(library (r6rs-benchmarks sumloop)
|
||||
(library (rnrs-benchmarks sumloop)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define sum 0)
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
;;; TAIL -- One of the Kernighan and Van Wyk benchmarks.
|
||||
|
||||
(library (r6rs-benchmarks tail)
|
||||
(library (rnrs-benchmarks tail)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define inport #f)
|
||||
(define outport #f)
|
|
@ -1,9 +1,9 @@
|
|||
;;; TAK -- A vanilla version of the TAKeuchi function.
|
||||
|
||||
|
||||
(library (r6rs-benchmarks tak)
|
||||
(library (rnrs-benchmarks tak)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define (tak x y z)
|
||||
(if (not (< y x))
|
|
@ -1,8 +1,8 @@
|
|||
;;; TAKL -- The TAKeuchi function using lists as counters.
|
||||
|
||||
(library (r6rs-benchmarks takl)
|
||||
(library (rnrs-benchmarks takl)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define (listn n)
|
||||
(if (= n 0)
|
|
@ -1,8 +1,8 @@
|
|||
;;; TRAV1 -- Benchmark which creates and traverses a tree structure.
|
||||
|
||||
(library (r6rs-benchmarks trav1)
|
||||
(library (rnrs-benchmarks trav1)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs mutable-pairs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs mutable-pairs) (rnrs-benchmarks))
|
||||
|
||||
(define (make-node)
|
||||
(vector 'node '() '() (snb) #f #f #f #f #f #f #f))
|
|
@ -1,8 +1,8 @@
|
|||
;;; TRAV2 -- Benchmark which creates and traverses a tree structure.
|
||||
|
||||
(library (r6rs-benchmarks trav2)
|
||||
(library (rnrs-benchmarks trav2)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs mutable-pairs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs mutable-pairs) (rnrs-benchmarks))
|
||||
|
||||
(define (make-node)
|
||||
(vector 'node '() '() (snb) #f #f #f #f #f #f #f))
|
|
@ -1,8 +1,8 @@
|
|||
;;; TRIANGL -- Board game benchmark.
|
||||
|
||||
(library (r6rs-benchmarks triangl)
|
||||
(library (rnrs-benchmarks triangl)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define *board*
|
||||
(list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
|
|
@ -1,8 +1,8 @@
|
|||
;;; WC -- One of the Kernighan and Van Wyk benchmarks.
|
||||
|
||||
(library (r6rs-benchmarks wc)
|
||||
(library (rnrs-benchmarks wc)
|
||||
(export main)
|
||||
(import (r6rs) (r6rs-benchmarks))
|
||||
(import (rnrs) (rnrs-benchmarks))
|
||||
|
||||
(define inport #f)
|
||||
|
Loading…
Reference in New Issue