unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Mikael Djurfeldt <mdj@kvast.blakulla.net>
Cc: djurfeldt@nada.kth.se
Subject: [pthreads] performance test using fib.scm
Date: Tue, 10 Dec 2002 19:16:04 +0100	[thread overview]
Message-ID: <E18LovM-0003lg-00@kvast.blakulla.net> (raw)

In the announcement of the pthreads support, I attached a program
fib.scm:

(define (par-fib n n-forks)
  (cond ((<= n 1) 1)
	((> n-forks 0)
	 (letpar ((f1 (par-fib (- n 1) (- n-forks 1)))
		  (f2 (par-fib (- n 2) (- n-forks 1))))
	   (+ f1 f2)))
	(else
	 (let ((f1 (mono-fib (- n 1)))
	       (f2 (mono-fib (- n 2))))
	   (+ f1 f2)))))

(define (mono-fib n)
  (let iter ((f1 1) (f2 1) (i 1))
    (if (>= i n)
	f2
	(iter f2 (+ f1 f2) (+ 1 i)))))

When I run this with a Guile compiled with COPT threads, it invariably
takes around 12 s to run (par-fib 40000 1) on my dual CPU machine.
"Top" reports 50% of CPU capacity usage during calculation.

With the new pthreads support (which now allows for real SMP), it
takes 2.6 s and top says 91%!

Still, for large fibonnaci numbers and large branch depths (many
threads), Guile often crashes in realloc.  That function should be
thread safe, shouldn't it?  Maybe we're trashing up the heap somewhere
else...

Anyone keen on some debugging? :-)

Mikael


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


             reply	other threads:[~2002-12-10 18:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-10 18:16 Mikael Djurfeldt [this message]
2002-12-10 21:10 ` [pthreads] performance test using fib.scm Wolfgang Jaehrling
2002-12-10 20:10   ` Mikael Djurfeldt
2002-12-11 20:05     ` Christopher Cramer
2002-12-11  5:02   ` Maciej Stachowiak
2002-12-11  7:11     ` Mikael Djurfeldt
2002-12-11 13:48       ` Maciej Stachowiak
2002-12-11 23:43         ` Han-Wen Nienhuys
2002-12-11 16:59       ` Wolfgang Jaehrling
     [not found] ` <200212110202.gBB22Et27423@mule.m17n.org>
2002-12-11 17:27   ` Wolfgang Jaehrling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E18LovM-0003lg-00@kvast.blakulla.net \
    --to=mdj@kvast.blakulla.net \
    --cc=djurfeldt@nada.kth.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).