Browse thread
[Caml-list] ocaml and large development projects
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Siegfried Gonzi <siegfried.gonzi@s...> |
| Subject: | [Caml-list] Reading a file |
Hi: Is there a better way in Ocaml to read a file line by line than via the read_line function? I use read_line on a file, perform some tasks on this line and store the results in a list and after having red the file I use List.rev. The problem actually is on big files the function is awfully slow. As similar Clean function takes 15 seconds, my Bigloo program takes 25 second and my C++ programs (via templates) takes 25 secondes but my Ocaml program takes 8 minutes. I am not sure how quick List.rev actually is? 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? Why my Clean function is that fast is incomprehensible for me. Does one know whether there exists a function in OCaml which converts a String to a character-list? I use this construct in Clean then in order to extract floating point numbers from that character list: ['1','.','2',...] and store this floating point numbers via pattern matching in my result-list. S. Gonzi > > ------------------- 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