From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id E0885BCAC for ; Wed, 25 May 2005 04:13:40 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j4P2DeHZ014492 for ; Wed, 25 May 2005 04:13:40 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id EAA16818 for ; Wed, 25 May 2005 04:13:40 +0200 (MET DST) Received: from publilogics.com (pouic.publilogics.com [213.186.50.35]) by concorde.inria.fr (8.13.0/8.13.0) with SMTP id j4P2DdAm008818 for ; Wed, 25 May 2005 04:13:39 +0200 Received: (qmail 6200 invoked from network); 25 May 2005 02:13:39 -0000 Received: from unknown (HELO PWARP) ([61.213.94.147]) (envelope-sender ) by pouic.publilogics.com (qmail-ldap-1.03) with SMTP for ; 25 May 2005 02:13:39 -0000 Message-ID: <002401c560cf$431259a0$0d05a8c0@PWARP> From: "Nicolas Cannasse" To: , References: <891bd33905052415145bb1818f@mail.gmail.com> <891bd339050524184221de71b8@mail.gmail.com> Subject: Re: [Caml-list] Re: Efficient I/O with threads Date: Wed, 25 May 2005 11:12:53 +0900 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-j-chkmail-Score: MSGID : 4293DF53.001 on concorde : j-chkmail score : X : 0/20 1 X-Miltered: at nez-perce with ID 4293DF54.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 4293DF53.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; cannasse:01 warplayer:01 caml-list:01 threads:01 ocaml:01 high-level:01 lambdas:01 api:01 decoding:01 buffer:01 sourceforge:01 functions:01 functions:01 underlying:01 caml:02 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: [snip] > Fixing this is perhaps too deep of a change to drive into the > OCaml system at this point. Is this a problem that is > addressed by the I/O channels provided by any other library > such as extlib? I can maybe answer on that one. Extlib IO channels provide "high-level" channels. A channel is just a record of lambdas that are used to read and write to it. There are implementations for reading and writing from caml low level channels, but also to input and output directly from a string. You can also create your own channels by providing the appropriate API functions ( 3 functions for input channels : read / input / close and 4 functions for output channels : write / output / flush / close ). This approach means that you can easily wrap one channel with another. For example there is a Base64 module that takes a channel as parameter and returns a channel that will either perform encoding or decoding in B64 and read/write to the underlying channel. The same approach could be used to add a buffer for either reading or writing. ExtLib IO channels are focused more on usability than performances. Using them require a very small overhead compared to using direct caml channels but is more flexible (you can later retarget your output to a string, or wrap it with a compression or encoding library) and if you're performing IO on disk it should not be so much different in terms of performances. Here's the module documentation : http://ocaml-lib.sourceforge.net/doc/IO.html Nicolas