Sorry, didn't meant to take this off list. Taking it back to the caml list.

I don't quite understand how this whole benchmark holds together.  Could you post the C code?  I don't understand the differences between (1), (2) and (3) well enough to explain where the factor of 100 comes in.

y

On Mon, Oct 25, 2010 at 10:33 AM, Jérémie Dimino <jeremie@dimino.org> wrote:
On Mon, Oct 25, 2010 at 07:59:17AM -0400, Yaron Minsky wrote:
>    What's the advantage of using mmap here?� Why not just have a few worker
>    threads available for doing file io?� Then you can use the ordinary file
>    API, and you don't need to spin up a brand new thread for each request.

It because the cost of switching to another thread is too big. I did the
following benchmarks some time ago (in C): i made three programs reading
a 100Mo file using a loop in the following way:

1 - just use read, without threads
2 - launch a thread at each iteration
3 - use only one thread created before entering the loop

And the results were the following:

- in any case (2) and (3) gave the same result,
- when the file was not in the cache, the execution time was the same
 for the three programs,
- when the file was in the cache, (2) and (3) were about 100 times
 slower than (1)

Jérémie