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 RAA05190; Mon, 28 Oct 2002 17:13:04 +0100 (MET) 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 RAA06141 for ; Mon, 28 Oct 2002 17:13:03 +0100 (MET) Received: from gull.mail.pas.earthlink.net (gull.mail.pas.earthlink.net [207.217.120.84]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g9SGD1512189; Mon, 28 Oct 2002 17:13:01 +0100 (MET) Received: from user-0ccegbj.cable.mindspring.com ([24.199.65.115] helo=[192.168.0.3]) by gull.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 186CVd-0002Uu-00; Mon, 28 Oct 2002 08:12:57 -0800 Subject: Re: [Caml-list] Strange slowness of input_line on mingw From: "Yaron M. Minsky" To: Xavier Leroy Cc: Caml List In-Reply-To: <20021028162614.A2882@pauillac.inria.fr> References: <32026.209.9.234.140.1035468351.squirrel@dragonfly.localdomain> <20021028162614.A2882@pauillac.inria.fr> Content-Type: text/plain Organization: Cornell University Message-Id: <1035821576.16358.38.camel@dragonfly.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.1.2 (Preview Release) Date: 28 Oct 2002 11:12:56 -0500 Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I don't think any of your explanations explain it: the lines weren't particularly long and I was using ocaml 3.06 on both linux and windows. And I did the test multiple times, in different orders, so the caching is not the issue. And, of course, the weirdest thing is that this appears to be a windows-specific problem. On Linux, there speed difference between wc and my program was quite small. The x70 difference was only found on the mingw builds I tried. (I didn't try a straight cygwin version, since I don't have that build system set up at present.) So, any other ideas, or suggestion as to how to narrow down the problem? Thanks, Yaron On Mon, 2002-10-28 at 10:26, Xavier Leroy wrote: > > I've noticed some strangely slow behavior from input_line on mingw. I > > wrote a simple loop to scan through a file, and found that for a given > > file, it took about 10 seconds to run, whereas wc -l took only a small > > fraction of a second -- the difference was about a factor of 70. This is > > on a W2K machine using mingw. On the other hand, using the same file on a > > linux box, the difference between wc -l and my code was only about a > > factor of 3. > > Any ideas where the big difference might be coming from? The code I > > wrote is attached below. > > input_line has to work a bit harder than wc because it actually copies > the data to strings. However, on my tests with your program (Linux, > OCaml 3.06), this makes essentially no difference: both your code and > wc run at about 50 Mb/s. > > Two possible explanations: > > 1- The file wasn't in the file cache when you timed your program; then you > timed wc, at which time the file was in the file cache. In other > terms, you're measuring the difference between a "cold cache read" and a > "warm cache read". Try measuring wc first :-) > > 2- Your file contains very long lines and you're using OCaml 3.04 or > earlier. There was a performance bug in pre-3.06 versions causing > input_line to run slowly on very long lines (100000 characters or > more). > > - Xavier Leroy > ------------------- > 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 ------------------- 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