caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christophe TROESTLER <Christophe.Troestler@umh.ac.be>
To: OCaml Mailing List <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] How to write efficient threaded programs on OCaml
Date: Wed, 08 Feb 2006 15:38:09 +0100 (CET)	[thread overview]
Message-ID: <20060208.153809.249505014.Christophe.Troestler@umh.ac.be> (raw)
In-Reply-To: <20060208192118.1755d70f.ocaml-erikd@mega-nerd.com>

On Wed, 8 Feb 2006, Erik de Castro Lopo <ocaml-erikd@mega-nerd.com> wrote:
> 
> This question (or variants of it) comes around quite regularly. The 
> standard response is:
> 
>     http://sardes.inrialpes.fr/~aschmitt/cwn/2002.11.26.html#8

Thanks for the link but I know about that answer (and sorry to start
yet again a discussion on this topic it's just that I can't figure out
why there is such a difference between programs using the same
concepts).  The test is supposed to be executed on a single processor
and can be seen as related to (2)-(3) [i.e. _not_ SMP] as there are 4
different threads -- one can think some are doing I/O, others are
listening to user events.  What is special about this test is that the
4 threads communicate a lot (this will obviously not be so intensive
in a real app but still lots of sync can happen).

My question is twofold.  When using the Event module in the same way
MLton does, the running time is ~30 times larger.  I'd like an
explanation about why there is such a huge difference and possible
ways to reduce it...  Using an implementation close to C (Mutex,
Condition) divides the time by 2 but still is about 6 times slower
than C.  Is it to say a better implementation is possible for OCaml ???

ChriS


---
P.S. BTW, these slowdowns especially happen with native code --
bytecode (with -vmthreads) is immensely faster (of course this is a
different implementation).


  reply	other threads:[~2006-02-08 14:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-07 23:15 Christophe TROESTLER
2006-02-08  8:21 ` [Caml-list] " Erik de Castro Lopo
2006-02-08 14:38   ` Christophe TROESTLER [this message]
2006-02-08 15:17     ` Xavier Leroy
2006-02-08 16:58       ` Matthieu Dubuget
2006-02-08 22:13       ` Christophe TROESTLER
2006-02-09 17:39         ` Alessandro Baretta
2006-02-09 22:26           ` Matthew Hannigan
2006-02-13 10:25 ` Florian Weimer
2006-02-16 18:11   ` Christophe TROESTLER

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

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

  git send-email \
    --in-reply-to=20060208.153809.249505014.Christophe.Troestler@umh.ac.be \
    --to=christophe.troestler@umh.ac.be \
    --cc=caml-list@yquem.inria.fr \
    /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 NNTP newsgroup(s).