Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] optimizing functors
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-01-31 (06:49)
From: David Monniaux <David.Monniaux@e...>
Subject: [Caml-list] optimizing functors
We are currently writing code containing lots of stacked functors. Most of
the implemented functions are simple manipulations (two lines) that invoke
functions in the functor's argument module.

OCaml does inlining of functions in the same module. Does it also do it
between different modules? Would it optimize the following:

module M=
  let f = function 0 -> true | _ -> false

module N (D : sig val f: int->bool end) =
  let f = D.f

module P=N(M)

Does the compiler optimize the call to f in P, resolving it directly to
M.f, or does it do multiple indirections?

David Monniaux  
Laboratoire d'informatique de l'École Normale Supérieure,
Paris, France

Bug reports:  FAQ:
To unsubscribe, mail  Archives: