From: Fabrice Le Fessant <fabrice@lefessant.net>
To: "Daniel M. Albro" <albro@humnet.ucla.edu>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Loop times
Date: Mon, 17 Mar 2003 12:39:02 +0100 [thread overview]
Message-ID: <15989.46038.984076.710373@lachesis.inria.fr> (raw)
In-Reply-To: <1047592439.1866.10.camel@giynz>
>
> OK, I just did a test of the three methods. Here's the code:
>
> Exception Version:
> -------------------------------------------------
> exception Break
>
> let _ =
> let ary = [|1;2;3;4;5;6;7;8;9;10;11;12|] in
> for i = 1 to 1_000_000_000 do
> try
> for j = 1 to 10 do
> if ary.(j) = 5 then
> raise Break
> done
> with Break -> ()
> done
>
> real 0m30.569s
> user 0m30.250s
> sys 0m0.140s
> ------------------------------------------------------
For the fun, could you try this one ? It does not allocate the
exception in the loop but outside.
-------------------------------------------------
exception Break
let _ =
let ary = [|1;2;3;4;5;6;7;8;9;10;11;12|] in
let exn = Break in
for i = 1 to 1_000_000_000 do
try
for j = 1 to 10 do
if ary.(j) = 5 then
raise exn
done
with Break -> ()
done
------------------------------------------------------
- Fabrice
-------------------
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:[~2003-03-17 12:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-13 21:53 Daniel M. Albro
2003-03-17 11:39 ` Fabrice Le Fessant [this message]
2003-03-17 18:59 ` Daniel M. Albro
[not found] ` <20030317214841.GA467@first.in-berlin.de>
2003-03-17 22:01 ` Daniel M. Albro
2003-03-18 9:57 ` Oliver Bandel
2003-03-18 8:52 Oliver Bandel
2003-03-18 15:21 ` Florian Hars
2003-03-18 15:40 ` Noel Welsh
2003-03-19 6:48 ` Daniel M. Albro
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=15989.46038.984076.710373@lachesis.inria.fr \
--to=fabrice@lefessant.net \
--cc=albro@humnet.ucla.edu \
--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