caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Sven LUTHER <luther@dpt-info.u-strasbg.fr>
To: Florian Hars <florian@hars.de>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Where does Ocaml spend all the time?
Date: Thu, 28 Jun 2001 10:34:53 +0200	[thread overview]
Message-ID: <20010628103453.A6217@lambda.u-strasbg.fr> (raw)
In-Reply-To: <20010628101635.A25747@hars>

On Thu, Jun 28, 2001 at 10:16:35AM +0200, Florian Hars wrote:
> I have written an ocaml program, which is about an order of magnitude
> slower than a similar C program, and now I am wondering what to do.
> According to gprof, I have neiter written nor called most of the
> top-scoring functions in my program:
> 
>   %   cumulative   self              self     total           
>  time   seconds   seconds    calls  ms/call  ms/call  name    
>   9.82      2.76     2.76  9822122     0.00     0.00  Verzeichnis_code_end
>   9.00      5.29     2.53     3275     0.77     0.77  mark_slice
>   8.15      7.58     2.29    17860     0.13     0.54  Stra$dfen_e_i_l_rec_129
>   8.04      9.84     2.26 23232718     0.00     0.00  string_equal
>   7.44     11.93     2.09     4088     0.51     0.62  sweep_slice
>   5.73     13.54     1.61   390646     0.00     0.01  oldify
>   4.16     14.71     1.17 22241546     0.00     0.00  Eintrag_code_begin
>   3.88     15.80     1.09                             Stringhilfsfunktionen_code_begin
> 
> Only the third and fourth entry seem to do anything "useful", the rest
> looks like administrative overhead to me. What are these functions
> doing?
> Are there any general hints on how to write ocaml programs for efficiency?
> Like, don't use functional updates for records to reduce garbage?

mmm, i am no expert, but the mark_slice and sweep_slice seems like
garbage_collector stuff.

I think there is a faq entry about efficiency and other such things, in
particular you have to know, please someone correct me if i am wrong, that the
updating of a reference or a mutable field can trigger a garbage collection.

Also ocaml is highly optimized for functional datatypes and curryified
function calls. 

Maybe this helps.

Friendly,

Sven Luther
-------------------
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-06-28  8:35 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 [this message]
2001-06-28  8:37 ` Xavier Leroy
2001-06-28 10:02   ` Florian Hars
2001-07-02 13:16     ` Xavier Leroy
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=20010628103453.A6217@lambda.u-strasbg.fr \
    --to=luther@dpt-info.u-strasbg.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).