caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Florian Hars <florian@hars.de>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Where does Ocaml spend all the time?
Date: Mon, 2 Jul 2001 15:16:49 +0200	[thread overview]
Message-ID: <20010702151649.A32562@pauillac.inria.fr> (raw)
In-Reply-To: <20010628120229.B25747@hars>; from florian@hars.de on Thu, Jun 28, 2001 at 12:02:29PM +0200

> Yes, that is one of the functions that I expected to take a lot of time,
> since the program does a lot of string comparision and matching.
> I was more surprised by the time spent in the <Modulename>_code_(begin|end)
> functions, what are these? Why are they called and by whom?

It's an artefact of gprof.  For each module, ocamlopt generates two
code symbols <Modulename>_code_begin and <Modulename>_code_end
that bracket the code for this module.  (These symbols are used to
determine the address range for the compiled code during marshaling.)
So, if you have two modules A and B and the first function in B is f,
you'd get something like:

        A_code_begin:
          ...
        A_code_end:
        B_code_begin:
        B_f:
          ... code for B.f ..
        ...
        B_code_end

and gprof now has three names to refer to the entry point of B.f:
B_f, A_code_end and B_code_begin, hence a 2 in 3 chance that it will
pick the wrong name :-)  

This could be fixed by inserting "nops" around the _code_begin and
_code_end symbols, at least when compiling in profiling mode.

> > At any rate, the GC-related functions account for only 25% of the
> > running time (which is typical for symbolic processing, but a bit high
> > for numerical processing)
> 
> So this is OK (except that it is 25% of quite a lot of time :-)

It's for programs that allocate a lot.  A C or C++ program with the
same allocation behavior would typically spend 50 to 90% of its time
in malloc() and free()  :-)

- 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-07-02 13:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-28  8:16 Florian Hars
2001-06-28  8:34 ` Sven LUTHER
2001-06-28  8:37 ` Xavier Leroy
2001-06-28 10:02   ` Florian Hars
2001-07-02 13:16     ` Xavier Leroy [this message]
2001-07-02 16:21       ` Chris Hecker
2001-06-28  8:39 ` Daniel de Rauglaudre
2001-06-28 10:02   ` Florian Hars
2001-06-28  8:50 ` Remi VANICAT

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=20010702151649.A32562@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=florian@hars.de \
    /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).