File: gobble.scm

package info (click to toggle)
chicken 5.3.0-2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 32,892 kB
  • sloc: ansic: 580,083; lisp: 71,987; tcl: 1,445; sh: 588; makefile: 60
file content (26 lines) | stat: -rw-r--r-- 528 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
;;;; gobble.scm
;
; usage: csi -s gobble.scm [COUNT]


(define (run n)
  (print "allocating " n " bytes ...")
  (let loop ((k 0))
    (when (< k n)
      (let ((x (make-string 1000)))
	(when (and (zero? (modulo k 100000)) (##sys#debug-mode?))
	  (print* "."))
	(loop (+ k 1000))))))

(run (string->number (optional (command-line-arguments) "1000000000")))
(newline)


; time csi -s gobble.scm 1000000000
;   5 secs
;
; csc goobble.scm -o a.out -O4 -b -d0
; time a.out 1000000000
;   3 secs
;
; (x86, Core2 Duo, 2.4Ghz, 2GB RAM)