caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Alexander V. Voinov" <avv@quasar.ipa.nw.ru>
To: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: [Caml-list] Generation of streams is slow
Date: Fri, 13 Jul 2001 15:06:15 -0700	[thread overview]
Message-ID: <3B4F70D7.82E58A91@quasar.ipa.nw.ru> (raw)

Hi All,

I've run the following program and found it to be extremely slow. Why?
Does it mean that streams are worth using only when they are built from
input text channels, and in all other cases they are just a waste of
time?

Alexander

open Printf

let gen_stream n =
  let rec gs i n =
    if i = n then [< 'n >] else [< 'i; (gs (i+1) n) >]
  in
  gs 1 n

let rec stupid_loop n s =
  if n > 0 then begin
    if n mod 1000 = 0 then (print_char('.'); flush stdout);
    let i = Stream.next s in
    if i <> n then raise (Failure "they don't match");
    stupid_loop (n+1) s
  end
  else 0;;

let _ =
  stupid_loop 1 (gen_stream 100000);;


-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


             reply	other threads:[~2001-07-13 22:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-13 22:06 Alexander V. Voinov [this message]
2001-07-14  2:27 ` Daniel de Rauglaudre
2001-07-14  2:51   ` Alexander V. Voinov
2001-07-14  4:04     ` Daniel de Rauglaudre
2001-07-14  4:15       ` Alexander V. Voinov
2001-07-14  4:40         ` Alexander V. Voinov
2001-07-14  8:34           ` Daniel de Rauglaudre
2001-07-14 18:08             ` Alexander V. Voinov
2001-07-14 19:02               ` Daniel de Rauglaudre
2001-07-14 19:51                 ` Alexander V. Voinov
2001-07-14 21:59                 ` Alexander V. Voinov
2001-07-14 22:29                   ` Daniel de Rauglaudre
2001-07-17  2:36               ` Jacques Garrigue
2001-07-14  8:31         ` Daniel de Rauglaudre
2001-07-20  7:49           ` Chris Hecker
2001-07-17 16:01 Dave Berry

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=3B4F70D7.82E58A91@quasar.ipa.nw.ru \
    --to=avv@quasar.ipa.nw.ru \
    --cc=caml-list@inria.fr \
    /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;
as well as URLs for NNTP newsgroup(s).