;;; Invoke this function to run a benchmark. The first argument is a string ;;; identifying the benchmark, while the second is a thunk to be called ;;; and the third is the number of repetitions. (define (run-benchmark name thunk . n) (let ((n (if (null? n) 1 (car n)))) (define (loop n) (if (zero? n) #t (begin (thunk) (loop (- n 1))))) (newline) (display "--------------------------------------------------------") (newline) (display name) (newline) ; time is a macro supplied by Chez Scheme (time (loop n))))