Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Stephan Houben <stephan@pcrm.win.tue.nl>, caml-list@inria.fr
Subject: Re: inlining functions called through functor parameters?
Date: Thu, 3 Feb 2000 19:38:38 +0100	[thread overview]
Message-ID: <20000203193838.23474@pauillac.inria.fr> (raw)
In-Reply-To: <20000131103447.A16550@pcrm.win.tue.nl>; from Stephan Houben on Mon, Jan 31, 2000 at 10:34:47AM +0100

> While searching the Caml mailing list archive, I found
> a message from Xavier Leroy, posted on Tue Jun 23 1998,
> in which he describes the fact that:
> "... it is true that functions taken from the
>  functor parameter are always called via their closures".
> I was wondering if this is still true (since 1998 is a long
> time ago, in internet time at least), and if there are any plans
> to implement more inlining for such functions.

Yes, this is still true.  So far, the body of a functor is compiled
only once (at the point where it's defined), and this precludes
inlining of the functions contained in the functor parameter (consider
two applications of the functor).

> The reason I ask is because I'm writing a couple of modules where
> lots of small funtions are called via a functor parameter, and
> I'm wondering if it's worth the trouble to inline them "by hand".

If the functor is applied only once, you could turn it into a
structure that references directly its argument; this will enable
automatic inlining.  Otherwise, and assuming that's the performance
bottleneck in your program, it could be worth the effort to inline
manually some of the functions.

All the best,

- Xavier Leroy



      reply	other threads:[~2000-02-04  7:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-31  9:34 Stephan Houben
2000-02-03 18:38 ` Xavier Leroy [this message]

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=20000203193838.23474@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=stephan@pcrm.win.tue.nl \
    /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