caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: [Caml-list] time complexity on basic data types
@ 2001-08-23 17:27 Krishnaswami, Neel
  2001-08-23 17:35 ` Xavier Leroy
  2001-08-23 22:29 ` Lars Nilsson
  0 siblings, 2 replies; 6+ messages in thread
From: Krishnaswami, Neel @ 2001-08-23 17:27 UTC (permalink / raw)
  To: caml-list

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: <URI:http://caml.inria.fr/ocaml/htmlman/manual065.html>)
 
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:
<URI:http://caml.inria.fr/ocaml/htmlman/manual029.html>

--
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


^ permalink raw reply	[flat|nested] 6+ messages in thread
* [Caml-list] time complexity on basic data types
@ 2001-08-23 16:16 Collin Monahan
  0 siblings, 0 replies; 6+ messages in thread
From: Collin Monahan @ 2001-08-23 16:16 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 726 bytes --]

 
Thanks to everyone who answered my questions yesterday. 
 
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 . . .
 
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.
 
Collin Monahan
 

[-- Attachment #2: Type: text/html, Size: 6288 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2001-08-24 12:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-23 17:27 [Caml-list] time complexity on basic data types Krishnaswami, Neel
2001-08-23 17:35 ` Xavier Leroy
2001-08-23 22:29 ` Lars Nilsson
2001-08-23 23:50   ` Gerd Stolpmann
2001-08-24 12:27   ` Jean-Christophe Filliatre
  -- strict thread matches above, loose matches on Subject: below --
2001-08-23 16:16 Collin Monahan

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).