caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* inlining functions called through functor parameters?
@ 2000-01-31  9:34 Stephan Houben
  2000-02-03 18:38 ` Xavier Leroy
  0 siblings, 1 reply; 2+ messages in thread
From: Stephan Houben @ 2000-01-31  9:34 UTC (permalink / raw)
  To: caml-list

Hello list,

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

Greetings,

Stephan Houben




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

* Re: inlining functions called through functor parameters?
  2000-01-31  9:34 inlining functions called through functor parameters? Stephan Houben
@ 2000-02-03 18:38 ` Xavier Leroy
  0 siblings, 0 replies; 2+ messages in thread
From: Xavier Leroy @ 2000-02-03 18:38 UTC (permalink / raw)
  To: Stephan Houben, caml-list

> 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



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

end of thread, other threads:[~2000-02-04  7:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-31  9:34 inlining functions called through functor parameters? Stephan Houben
2000-02-03 18:38 ` Xavier Leroy

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