caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] functor question
@ 2002-07-24  4:26 Brian Naylor
  2002-07-25  9:21 ` Xavier Leroy
  0 siblings, 1 reply; 3+ messages in thread
From: Brian Naylor @ 2002-07-24  4:26 UTC (permalink / raw)
  To: caml-list

Is there any efficiency difference between:

module Foo = Make (Bar) (Baz)

and

module Both = struct module Bar = Bar module Baz = Baz end
module Foo = Make (Both)

In other words, is it better to coalesce structures into a single functor
application rather than to apply multiple functors?  Do I pay more indirection
costs in the first case?  Thanks.


__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] functor question
  2002-07-24  4:26 [Caml-list] functor question Brian Naylor
@ 2002-07-25  9:21 ` Xavier Leroy
  2002-07-25  9:55   ` [Caml-list] Functors, Modules and Indirections Thorsten Ohl
  0 siblings, 1 reply; 3+ messages in thread
From: Xavier Leroy @ 2002-07-25  9:21 UTC (permalink / raw)
  To: Brian Naylor; +Cc: caml-list

> Is there any efficiency difference between:
> module Foo = Make (Bar) (Baz)
> and
> module Both = struct module Bar = Bar module Baz = Baz end
> module Foo = Make (Both)
> In other words, is it better to coalesce structures into a single
> functor application rather than to apply multiple functors?  Do I
> pay more indirection costs in the first case?  Thanks.

Actually, you pay one more indirection in the second case (Make(Both)).

- Xavier Leroy
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* [Caml-list] Functors, Modules and Indirections
  2002-07-25  9:21 ` Xavier Leroy
@ 2002-07-25  9:55   ` Thorsten Ohl
  0 siblings, 0 replies; 3+ messages in thread
From: Thorsten Ohl @ 2002-07-25  9:55 UTC (permalink / raw)
  To: caml-list

Xavier Leroy <xavier.leroy@inria.fr> writes:

> [...] you pay one more indirection [...]

Is there a theoretical reason for the native compiler not to resolve
module indirections (including inlining) statically at compile time?
[I see that it would break independent compilation for the bytecode
compiler, but the native compiler requires recompilation of dependent
modules anyway.]

Or is there a technical reason other than potential code bloat?

Or are there plane to implement it?

In most cases, the performance penalty will be only a small constant
factor, but it would be nice not having to worry about it at all ---
even in hotspots.

Curious,
-Thorsten
-- 
Thorsten Ohl, Physics Dept., Wuerzburg Univ. -- ohl@physik.uni-wuerzburg.de
http://theorie.physik.uni-wuerzburg.de/~ohl/     [<=== PGP public key here]
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

end of thread, other threads:[~2002-07-26 21:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-24  4:26 [Caml-list] functor question Brian Naylor
2002-07-25  9:21 ` Xavier Leroy
2002-07-25  9:55   ` [Caml-list] Functors, Modules and Indirections Thorsten Ohl

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