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 TAA04390; Thu, 23 Aug 2001 19:23:56 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA04348 for ; Thu, 23 Aug 2001 19:23:55 +0200 (MET DST) Received: from smtp1.cswv.com (smtp1.cswv.com [4.17.129.17]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f7NHNrX03083 for ; Thu, 23 Aug 2001 19:23:54 +0200 (MET DST) Received: from smtp1.cswv.com ([4.17.129.17]) by smtp1.cswv.com with Microsoft SMTPSVC(5.5.1877.197.19); Thu, 23 Aug 2001 13:24:59 -0400 Received: FROM exchange1.cswv.com BY smtp1.cswv.com ; Thu Aug 23 13:24:59 2001 -0400 Received: by exchange1.cswv.com with Internet Mail Service (5.5.2653.19) id ; Thu, 23 Aug 2001 13:27:53 -0400 Message-ID: From: "Krishnaswami, Neel" To: caml-list@inria.fr Subject: Re: [Caml-list] time complexity on basic data types Date: Thu, 23 Aug 2001 13:27:45 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Collin Monahan [mailto:cmonahan@fame.com] wrote: > > With respect to arrays and lists, is the complexity for operations > on these data structures like "normal?" E.g. random access in arrays > in constant time, insertion in lists in constant time, random access > in lists in linear time . . . Yep, that's correct. > What facilities exist for timing constructs in Caml? I see > val times : unit -> process_times > in the manual, under unix system calls. If this is like the times() > function in Solaris, then it would work. But I think the Caml syntax > is messing me up again, because if I type > times();; > or > let foo = times();; > into the toplevel, the system indicates that "times" is not bound. Okay, first of all, to reference a name in another module you have to qualify the name with the module. Eg, you'd need to type Unix.times(), rather than just times(). Second, for reasons I don't understand the Unix library is not linked by default, so you need to explicitly specify it when you compile your programs. (This is described at the top of the chapter on the Unix library: ) In addition to this, you can also use the nice profiler that comes with the OCaml distribution, which gives you all sorts of fancy instruction counts. That's in chapter 16 of the Caml manual: -- Neel Krishnaswami neelk@cswcasa.com ------------------- 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