caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Yaron Minsky <yminsky@gmail.com>
To: "Jérémie Dimino" <jeremie@dimino.org>, caml-list@inria.fr
Subject: Re: [Caml-list] Asynchronous IO programming in OCaml
Date: Mon, 25 Oct 2010 11:34:41 -0400	[thread overview]
Message-ID: <AANLkTikZvCMQaOFknx4TBKUESpYcc2riRUexpU4QnFht@mail.gmail.com> (raw)
In-Reply-To: <20101025143317.GB32282@aurora>

[-- Attachment #1: Type: text/plain, Size: 1357 bytes --]

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
>

[-- Attachment #2: Type: text/html, Size: 1748 bytes --]

  parent reply	other threads:[~2010-10-25 15:34 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-24 10:34 Jon Harrop
2010-10-24 12:51 ` [Caml-list] " philippe
2010-10-24 12:52 ` Dario Teixeira
2010-10-24 16:33   ` oliver
2010-10-24 18:50     ` Dario Teixeira
2010-10-24 19:04       ` bluestorm
2010-10-24 20:02       ` oliver
2010-10-24 21:51     ` Michael Ekstrand
2010-10-24 16:17 ` Jake Donham
2010-10-24 20:54   ` Anil Madhavapeddy
2010-10-24 22:50     ` Jérémie Dimino
2010-10-25  3:42       ` Markus Mottl
2010-10-25  7:49         ` Richard Jones
2010-10-25  8:42       ` Goswin von Brederlow
2010-10-25 11:10         ` Jérémie Dimino
     [not found]           ` <AANLkTimP77PDEChW3Yt6uUy_qxYpj6EOZWQ_==id-LBC@mail.gmail.com>
     [not found]             ` <20101025143317.GB32282@aurora>
2010-10-25 15:34               ` Yaron Minsky [this message]
2010-10-25 17:26                 ` Jérémie Dimino
2010-10-27  9:33                   ` Goswin von Brederlow
2010-10-27 11:18                     ` Jérémie Dimino
2010-10-27 13:43                       ` Goswin von Brederlow
2010-10-27 15:30                         ` Jérémie Dimino
2010-10-28  9:00                           ` Goswin von Brederlow
2010-10-28  9:28                             ` Jérémie Dimino
2010-10-28 10:11                               ` Goswin von Brederlow
2010-10-25 15:58           ` DS
2010-10-24 20:42 ` Goswin von Brederlow

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=AANLkTikZvCMQaOFknx4TBKUESpYcc2riRUexpU4QnFht@mail.gmail.com \
    --to=yminsky@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=jeremie@dimino.org \
    /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).