dumb.sch 574 B

12345678910111213141516171819202122
  1. ; Dumb benchmark to test the reporting of words marked during gc.
  2. ; Example: (foo 1000000)
  3. (define (ballast bytes)
  4. (do ((bytes bytes (- bytes 8))
  5. (x '() (cons bytes x)))
  6. ((zero? bytes) x)))
  7. (define (words-benchmark bytes0 bytes1)
  8. (let ((x (ballast bytes0)))
  9. (do ((bytes1 bytes1 (- bytes1 8)))
  10. ((not (positive? bytes1))
  11. (car (last-pair x)))
  12. (cons (car x) bytes1))))
  13. (define (foo n)
  14. (collect)
  15. (display-memstats (memstats))
  16. (run-benchmark "foo" (lambda () (words-benchmark 1000000 n)) 1)
  17. (display-memstats (memstats)))