Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Threads performance issue.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-02-17 (10:07)
From: Sylvain Le Gall <sylvain@l...>
Subject: Re: Threads performance issue.
On 17-02-2009, Rémi Dewitte <> wrote:
> test.csv is a 21mo file with ~13k rows and a thousands of columns on a 15rp=
> m
> disk.
> ocaml version : 3.11.0

You are using input_char and standard IO channel. This is a good choice
for non-threaded program. But in your case, I will use with a
big buffer (32KB to 4MB) and change your program to use it. As
benchmarked by John Harrop, you are spending most of your time in
caml_enter|leave_blocking section. I think it comes from reading using
std IO channel which use 4k buffer. Using a bigger buffer will allow
less call to this two functions (but you won't win time at the end, I
think you will just reduce the difference between non-threaded and
threaded code).

Sylvain Le Gall