Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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=
struct
  let f = function 0 -> true | _ -> false
end

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

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            http://www.di.ens.fr/~monniaux
Laboratoire d'informatique de l'École Normale Supérieure,
Paris, France

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