~ chicken-core (chicken-5) 9c742da9256dc4a7219c0d4e10cec07b83143551


commit 9c742da9256dc4a7219c0d4e10cec07b83143551
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Sun Nov 14 17:50:03 2010 +0100
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Sun Nov 14 17:50:03 2010 +0100

    added allocation benchmark

diff --git a/distribution/manifest b/distribution/manifest
index f8437edf..e0e083d8 100644
--- a/distribution/manifest
+++ b/distribution/manifest
@@ -96,6 +96,7 @@ stub.scm
 support.scm
 tcp.scm
 tests/thread-list.scm
+tests/gobble.scm
 tests/test-optional.scm
 tests/arithmetic-test.scm
 tests/arithmetic-test.32.expected
diff --git a/tests/gobble.scm b/tests/gobble.scm
new file mode 100644
index 00000000..b587bb14
--- /dev/null
+++ b/tests/gobble.scm
@@ -0,0 +1,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#fudge 13))
+	  (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)
diff --git a/tests/runbench.sh b/tests/runbench.sh
index c673e53c..61154435 100644
--- a/tests/runbench.sh
+++ b/tests/runbench.sh
@@ -65,4 +65,8 @@ run
 
 echo "======================================== threads ... "
 $compile thread-list.scm -O4 -d0 -fb
-run
+run 1000000
+
+echo "======================================== allocation ... "
+$compile gobble.scm -O4 -d0 -b
+run 1000000000
diff --git a/tests/thread-list.scm b/tests/thread-list.scm
index eabc0942..74ffdd6b 100644
--- a/tests/thread-list.scm
+++ b/tests/thread-list.scm
@@ -19,26 +19,26 @@
 	    (sub1 n)
 	    (make-thread
 	     (lambda ()
-	       (thread-start! prev)
-	       (bump n))))))))
+	       (bump n)
+	       (thread-start! prev))))))))
 
 (define (bump n)
   (set! count (sub1 count))
   (cond ((zero? count) 
 	 (newline)
 	 (exit))
-	((zero? (modulo n 1000))
+	((and (zero? (modulo n 10000)) (##sys#fudge 13))
 	 (print* "."))))
 
 (run (string->number (optional (command-line-arguments) "250000")))
 (thread-sleep! 604800)
 
 
-; time csi -s thread-list.scm 1000000 -:h1g -:d
+; time csi -s thread-list.scm 1000000 -:h1g
 ;   11 secs
 ;
 ; csc thread-list.scm -o a.out -v -O4 -f -d0
-; time a.out 1000000 -:h1g -:d
+; time a.out 1000000 -:h1g
 ;   4 secs
 ;
 ; (x86, Core2 Duo, 2.4Ghz, 2GB RAM)
Trap