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 UAA28393; Mon, 17 Mar 2003 20:00:24 +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 UAA29403 for ; Mon, 17 Mar 2003 20:00:23 +0100 (MET) Received: from dahlia.noc.ucla.edu (dahlia.noc.ucla.edu [169.232.46.11]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h2HJ0Mf20166 for ; Mon, 17 Mar 2003 20:00:22 +0100 (MET) Received: from orchid.noc.ucla.edu (orchid.noc.ucla.edu [169.232.48.12]) by dahlia.noc.ucla.edu (8.12.8/8.12.8) with ESMTP id h2HIxwmo008784; Mon, 17 Mar 2003 10:59:59 -0800 Received: from humnet.ucla.edu (vp191026.reshsg.uci.edu [128.195.191.26]) (authenticated bits=0) by orchid.noc.ucla.edu (8.12.8/8.12.8) with ESMTP id h2HJ0C2T010869; Mon, 17 Mar 2003 11:00:20 -0800 Message-ID: <3E761B0F.8050303@humnet.ucla.edu> Date: Mon, 17 Mar 2003 10:59:27 -0800 From: "Daniel M. Albro" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030316 Debian/1.3-1 X-Accept-Language: en MIME-Version: 1.0 To: fabrice@lefessant.net CC: caml-list@inria.fr Subject: Re: [Caml-list] Loop times References: <1047592439.1866.10.camel@giynz> <15989.46038.984076.710373@lachesis.inria.fr> In-Reply-To: <15989.46038.984076.710373@lachesis.inria.fr> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.25 / SpamAssassin 2.43 / mail.ucla.edu X-Probable-Spam: no X-Spam-Hits: -2.8 X-Spam: no; 0.00; ucla:99 caml-list:01 0.000:01 fabrice's:01 exception:02 wrote:03 allocate:03 exn:03 sys:03 let:04 ary:04 fabrice:04 raise:05 daniel:06 fessant:06 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk OK, I did this test, but first after making the thing compatible with the other tests I did. (That is, the j loop should be 0 to 9 (or some other number less than 12 and greater than 4). The first version (once again, after changing the j loop to 0 to 9) takes real 0m34.033s user 0m34.030s sys 0m0.000s and Fabrice's version (with 0 to 9) takes real 0m28.086s user 0m28.080s sys 0m0.000s so it is definitely a win. - Dan Fabrice Le Fessant wrote: >> >> 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