caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: "Krishnaswami, Neel" <neelk@cswcasa.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] time complexity on basic data types
Date: Thu, 23 Aug 2001 19:35:52 +0200	[thread overview]
Message-ID: <20010823193552.A32344@pauillac.inria.fr> (raw)
In-Reply-To: <B1E4D3274D57D411BE8400D0B783FF322E86CE@exchange1.cswv.com>; from neelk@cswcasa.com on Thu, Aug 23, 2001 at 01:27:45PM -0400

> > What facilities exist for timing constructs in Caml? I see 
> >            val times : unit -> process_times
> > in the manual, under unix system calls.

The most portable way to time a piece of code is via the Sys.time()
function.  It's part of the OCaml standard library, so it's guaranteed
to work on all ports of OCaml -- even non-Unix ones.

The Unix.times() function is more Unix-specific and is provided by an
external library, which you have to request explicitly (as Neel
explained).

> Second,
> for reasons I don't understand the Unix library is not linked by 
> default,

The main reason is that it might not be available (on a non-Unix
platform, for instance).  (OK, both the Windows and the MacOS ports of
OCaml have reasonable Unix emulation built-in, but that wasn't always
the case, and hypothetical ports to other OSes might not have it either.)
In other terms, the modules that are linked by default, that is, those
in the standard library, are the modules that are available
everywhere; other modules are in separate libraries, not linked in by
default.

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

Correct.  There's also the option of using ocamlopt -p in conjunction
with the Unix profiler "gprof".

- Xavier Leroy
-------------------
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-08-23 17:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-23 17:27 Krishnaswami, Neel
2001-08-23 17:35 ` Xavier Leroy [this message]
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

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=20010823193552.A32344@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=neelk@cswcasa.com \
    /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).