I considered Ruby… but then learned that MRI only implements green threads… Thanks for the suggestions for other languages… Perl actually supports threads? Who would have thought! Can I ask for your help in translating the benchmark program? The actual computation performed by the “short-delay” procedure doesn’t matter, but it should take about 50 microseconds (in order to isolate the performance related to the implementation of threads). Marc ;;; Compute fib using threads. (declare (standard-bindings) (fixnum) (not safe) (block)) (define big 0) (define (granularity-set! g) (set! big (expt 11 g))) (define (short-delay) (integer-sqrt big)) (define (tfib n) (short-delay) (if (< n 2) 1 (let* ((x (thread-start! (make-thread (lambda () (tfib (- n 2)))))) (y (tfib (- n 1)))) (+ (thread-join! x) y)))) (define (range i j) (let loop ((j (- j 1)) (lst '())) (if (< j i) lst (loop (- j 1) (cons j lst))))) (define (go n repeat) (let ((threads (map (lambda (i) (make-thread (lambda () (tfib n)))) (range 0 repeat)))) (for-each thread-start! threads) (map thread-join! threads))) (granularity-set! 0) (go 15 100) (granularity-set! 1001) ;; granularity of about 50us per thread (go 15 20)
On Mar 10, 2017, at 7:30 PM, C K Kashyap <ckkashyap@gmail.com> wrote:
Super!!! Perl 5 may be a good candidate as well. Regards, Kashyap
On Fri, Mar 10, 2017 at 4:28 PM, Bradley Lucier <lucier@math.purdue.edu> wrote: Would a multi-threaded http server test what you want to test?
Brad _______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list