From: Xavier Leroy <xavier.leroy@inria.fr>
To: "Yaron M. Minsky" <yminsky@CS.Cornell.EDU>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Strange slowness of input_line on mingw
Date: Mon, 28 Oct 2002 16:26:14 +0100 [thread overview]
Message-ID: <20021028162614.A2882@pauillac.inria.fr> (raw)
In-Reply-To: <32026.209.9.234.140.1035468351.squirrel@dragonfly.localdomain>; from yminsky@CS.Cornell.EDU on Thu, Oct 24, 2002 at 10:05:51AM -0400
> 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
next prev parent reply other threads:[~2002-10-28 15:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-24 14:05 Yaron M. Minsky
2002-10-28 15:26 ` Xavier Leroy [this message]
2002-10-28 16:12 ` Yaron M. Minsky
2002-10-28 17:14 ` M E Leypold @ labnet
2002-10-28 17:28 ` Sven Luther
2002-10-28 17:42 ` Yaron M. Minsky
2002-10-29 0:10 ` Oleg
2002-10-29 1:06 ` Yaron M. Minsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20021028162614.A2882@pauillac.inria.fr \
--to=xavier.leroy@inria.fr \
--cc=caml-list@inria.fr \
--cc=yminsky@CS.Cornell.EDU \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox