Version française
Home     About     Download     Resources     Contact us    
Browse thread
How to write efficient threaded programs on OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: [Caml-list] How to write efficient threaded programs on OCaml
> 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