~ chicken-core (master) /tests/gobble.scm
Trap1;;;; gobble.scm
2;
3; usage: csi -s gobble.scm [COUNT]
4
5
6(define (run n)
7 (print "allocating " n " bytes ...")
8 (let loop ((k 0))
9 (when (< k n)
10 (let ((x (make-string 1000)))
11 (when (and (zero? (modulo k 100000)) (##sys#debug-mode?))
12 (print* "."))
13 (loop (+ k 1000))))))
14
15(run (string->number (optional (command-line-arguments) "1000000000")))
16(newline)
17
18
19; time csi -s gobble.scm 1000000000
20; 5 secs
21;
22; csc goobble.scm -o a.out -O4 -b -d0
23; time a.out 1000000000
24; 3 secs
25;
26; (x86, Core2 Duo, 2.4Ghz, 2GB RAM)