~ chicken-core (chicken-5) c5170b1676cb6faf83ae4263cadc4e028594d62d
commit c5170b1676cb6faf83ae4263cadc4e028594d62d Author: felix <felix@call-with-current-continuation.org> AuthorDate: Sun Nov 14 16:19:53 2010 +0100 Commit: felix <felix@call-with-current-continuation.org> CommitDate: Sun Nov 14 16:19:53 2010 +0100 added thread-list benchmark diff --git a/distribution/manifest b/distribution/manifest index c559cc66..f8437edf 100644 --- a/distribution/manifest +++ b/distribution/manifest @@ -95,6 +95,7 @@ srfi-4.scm stub.scm support.scm tcp.scm +tests/thread-list.scm tests/test-optional.scm tests/arithmetic-test.scm tests/arithmetic-test.32.expected diff --git a/tests/runbench.sh b/tests/runbench.sh index 87be9d1a..c673e53c 100644 --- a/tests/runbench.sh +++ b/tests/runbench.sh @@ -62,3 +62,7 @@ run echo "======================================== fft/unboxed ... " $compile fft.scm -D unboxed run + +echo "======================================== threads ... " +$compile thread-list.scm -O4 -d0 -fb +run diff --git a/tests/thread-list.scm b/tests/thread-list.scm new file mode 100644 index 00000000..eabc0942 --- /dev/null +++ b/tests/thread-list.scm @@ -0,0 +1,44 @@ +;;;; thread-list.scm +; +; usage: csi -s thread-list.scm [COUNT] + +(use srfi-18) + + +(define count #f) + +(define (run n) + (set! count n) + (print "creating " n " threads ...") + (let loop ((n n) (prev #f)) + (cond ((negative? n) + (print "starting ...") + (thread-start! prev)) + (else + (loop + (sub1 n) + (make-thread + (lambda () + (thread-start! prev) + (bump n)))))))) + +(define (bump n) + (set! count (sub1 count)) + (cond ((zero? count) + (newline) + (exit)) + ((zero? (modulo n 1000)) + (print* ".")))) + +(run (string->number (optional (command-line-arguments) "250000"))) +(thread-sleep! 604800) + + +; time csi -s thread-list.scm 1000000 -:h1g -:d +; 11 secs +; +; csc thread-list.scm -o a.out -v -O4 -f -d0 +; time a.out 1000000 -:h1g -:d +; 4 secs +; +; (x86, Core2 Duo, 2.4Ghz, 2GB RAM)Trap