| 1 | (define (benchmark seed) |
| 2 | (let ((limit (+ 1000 seed)) (h (make-eqv-hashtable))) |
| 3 | (let fill ((n 0)) |
| 4 | (if (< n limit) |
| 5 | (begin (hashtable-set! h (modulo n 256) (+ 1 (hashtable-ref h (modulo n 256) 0))) (fill (+ n 1))))) |
| 6 | (let sum ((i 0) (acc 0)) |
| 7 | (if (= i 256) acc (sum (+ i 1) (+ acc (hashtable-ref h i 0))))))) |
| 8 | (define (run-batch count) |
| 9 | (let loop ((left count) (seed 0)) |
| 10 | (if (= left 0) 1000 |
| 11 | (if (= (benchmark seed) (if (= seed 0) 1000 (if (= seed 1) 1001 (if (= seed 2) 1002 1003)))) |
| 12 | (loop (- left 1) (if (= seed 3) 0 (+ seed 1))) #f)))) |
| 13 | |