<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2006/02/ba69e3f637900ed5b9a81ab36432302a"
  from="Christophe TROESTLER &lt;Christophe.Troestler@u...&gt;"
  author="Christophe TROESTLER"
  date="2006-02-08T14:38:22"
  subject="Re: [Caml-list] How to write efficient threaded programs on OCaml"
  prev="2006/02/4ffb4c99b0e01144449b378a59595868"
  next="2006/02/ffd3c37c09ea8166f8864f74f592246e"
  prev-in-thread="2006/02/8d4fd8575d33db86ab919dcb9d92ceb0"
  next-in-thread="2006/02/dab51431550d81c48172d697ed6abd7f"
  prev-thread="2006/02/e8e061a36eebffc17c3ac923c74535fc"
  next-thread="2006/02/38106d71003e52b2286dfdcb5936de4f"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="How to write efficient threaded programs on OCaml">
<msg 
  url="2006/02/2858f1e4532daae90d5b0762e3fff3cd"
  from="Christophe TROESTLER &lt;Christophe.Troestler@u...&gt;"
  author="Christophe TROESTLER"
  date="2006-02-07T23:15:58"
  subject="How to write efficient threaded programs on OCaml">
<msg 
  url="2006/02/8d4fd8575d33db86ab919dcb9d92ceb0"
  from="Erik de Castro Lopo &lt;ocaml-erikd@m...&gt;"
  author="Erik de Castro Lopo"
  date="2006-02-08T08:21:25"
  subject="Re: [Caml-list] How to write efficient threaded programs on OCaml">
<msg 
  url="2006/02/ba69e3f637900ed5b9a81ab36432302a"
  from="Christophe TROESTLER &lt;Christophe.Troestler@u...&gt;"
  author="Christophe TROESTLER"
  date="2006-02-08T14:38:22"
  subject="Re: [Caml-list] How to write efficient threaded programs on OCaml">
<msg 
  url="2006/02/dab51431550d81c48172d697ed6abd7f"
  from="Xavier Leroy &lt;Xavier.Leroy@i...&gt;"
  author="Xavier Leroy"
  date="2006-02-08T15:17:40"
  subject="Re: [Caml-list] How to write efficient threaded programs on OCaml">
<msg 
  url="2006/02/13560aa4b6441de8642a3cc923b5bdb2"
  from="Matthieu Dubuget &lt;matthieu.dubuget@l...&gt;"
  author="Matthieu Dubuget"
  date="2006-02-08T16:55:15"
  subject="Re: [Caml-list] How to write efficient threaded programs on OCaml">
</msg>
<msg 
  url="2006/02/69ecf29a7a4b470c82efbd9670ae271b"
  from="Christophe TROESTLER &lt;Christophe.Troestler@u...&gt;"
  author="Christophe TROESTLER"
  date="2006-02-08T22:13:44"
  subject="Re: [Caml-list] How to write efficient threaded programs on OCaml">
<msg 
  url="2006/02/58e39975dccbb2d8104ae347f9080a44"
  from="Alessandro Baretta &lt;a.baretta@b...&gt;"
  author="Alessandro Baretta"
  date="2006-02-09T17:49:04"
  subject="Re: [Caml-list] How to write efficient threaded programs on OCaml">
<msg 
  url="2006/02/778886ccf985c5e4118a759b4642a6fd"
  from="Matthew Hannigan &lt;mlh@z...&gt;"
  author="Matthew Hannigan"
  date="2006-02-09T23:24:32"
  subject="Re: [Caml-list] How to write efficient threaded programs on OCaml">
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2006/02/f6d6dd723dfe60f938c19fe88ed24c99"
  from="Florian Weimer &lt;fw@d...&gt;"
  author="Florian Weimer"
  date="2006-02-13T10:28:49"
  subject="Re: [Caml-list] How to write efficient threaded programs on OCaml">
<msg 
  url="2006/02/4cc1ecf5ea45bb6b9d9360127dbcac9e"
  from="Christophe TROESTLER &lt;Christophe.Troestler@u...&gt;"
  author="Christophe TROESTLER"
  date="2006-02-16T18:11:17"
  subject="Re: [Caml-list] How to write efficient threaded programs on OCaml">
</msg>
</msg>
</msg>
</thread>

<contents>
On Wed, 8 Feb 2006, Erik de Castro Lopo &lt;ocaml-erikd@mega-nerd.com&gt; wrote:
&gt; 
&gt; This question (or variants of it) comes around quite regularly. The 
&gt; standard response is:
&gt; 
&gt;     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).

</contents>

</message>

