From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id MAA11325; Tue, 20 May 2003 12:55:14 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 MAA11315 for ; Tue, 20 May 2003 12:55:13 +0200 (MET DST) Received: from fichte.ai.univie.ac.at (fichte.ai.univie.ac.at [131.130.174.156]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h4KAtCH28256 for ; Tue, 20 May 2003 12:55:12 +0200 (MET DST) Received: from fichte.ai.univie.ac.at (markus@localhost.ai.univie.ac.at [127.0.0.1]) by fichte.ai.univie.ac.at (8.12.3/8.12.3/Debian-6.3) with ESMTP id h4KAtBwf030593; Tue, 20 May 2003 12:55:11 +0200 Received: (from markus@localhost) by fichte.ai.univie.ac.at (8.12.3/8.12.3/Debian-6.3) id h4KAtBAG030592; Tue, 20 May 2003 12:55:11 +0200 Date: Tue, 20 May 2003 12:55:11 +0200 From: Markus Mottl To: Siegfried Gonzi Cc: "'caml-list@inria.fr'" Subject: Re: [Caml-list] Reading a file Message-ID: <20030520105511.GA30358@fichte.ai.univie.ac.at> Mail-Followup-To: Siegfried Gonzi , "'caml-list@inria.fr'" References: <4.3.2.7.2.20030517225010.04b748a0@localhost> <4.3.2.7.2.20030519120753.04545700@localhost> <200305201007.17990.wolfgang.mueller2@uni-bayreuth.de> <3EC9EA84.3070404@stud.uni-graz.at> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3EC9EA84.3070404@stud.uni-graz.at> User-Agent: Mutt/1.4.1i X-Spam: no; 0.00; caml-list:01 siegfried:01 gonzi:01 flushes:01 stdout:01 bigloo:01 ocaml:01 handler:01 schrieb:01 constructs:02 mottl:02 exception:02 overhead:03 versa:03 markus:04 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Siegfried Gonzi schrieb am Dienstag, den 20. Mai 2003: > Is there a better way in Ocaml to read a file line by line than via the > read_line function? Yes: use "input_line"! "read_line" flushes stdout, which you'll probably not need. > I am not sure how quick List.rev actually is? As quick as it can be... This problem is most likely not related to List.rev. > In Bigloo reversing a list > has more or less no overhead. My Bigloo function is similar to my OCaml > function. Could it be that OCaml is that slow because I use "try and > with" constructs in order to check for the end of a file? If you create the exception handler within a loop, this will also be a bit costly. The loop should be within the exception handler, not vice versa. Regards, Markus Mottl -- Markus Mottl http://www.oefai.at/~markus markus@oefai.at ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners