Datasets:

License:
File size: 574 Bytes
3dcad1f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
; Dumb benchmark to test the reporting of words marked during gc.
; Example: (foo 1000000)

(define (ballast bytes)
  (do ((bytes bytes (- bytes 8))
       (x '() (cons bytes x)))
      ((zero? bytes) x)))

(define (words-benchmark bytes0 bytes1)
  (let ((x (ballast bytes0)))
    (do ((bytes1 bytes1 (- bytes1 8)))
        ((not (positive? bytes1))
         (car (last-pair x)))
        (cons (car x) bytes1))))

(define (foo n)
  (collect)
  (display-memstats (memstats))
  (run-benchmark "foo" (lambda () (words-benchmark 1000000 n)) 1)
  (display-memstats (memstats)))