caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Christophe TROESTLER <Christophe.Troestler@umh.ac.be>
Cc: 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 16:17:33 +0100	[thread overview]
Message-ID: <43EA0B8D.6090906@inria.fr> (raw)
In-Reply-To: <20060208.153809.249505014.Christophe.Troestler@umh.ac.be>

> 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 ???

Could you please tell us where to find the OCaml code you're
discussing?  I haven't seen it anywhere on the Web page you posted.

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

You've answered your own question: context switches with system
threads can be expensive depending on the characteristics of the
underlying POSIX threads implementation.  You're really testing
threading libraries, not language implementations.

My feelings at this point (without having seen the code nor the task
spec) is that you don't want to use threads at all, rather something
like CPS.

- Xavier Leroy


  reply	other threads:[~2006-02-08 15:17 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
2006-02-08 15:17     ` Xavier Leroy [this message]
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=43EA0B8D.6090906@inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=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).