caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* OCaml defunctorization and other optimizations
@ 2010-05-19 12:58 Török Edwin
  2010-05-20  8:41 ` [Caml-list] " Julien Signoles
  0 siblings, 1 reply; 6+ messages in thread
From: Török Edwin @ 2010-05-19 12:58 UTC (permalink / raw)
  To: caml-list

Hi,

I've seen in several places recommendations to use 'ocamldefun' to speed
up OCaml programs that use functors heavily [*].

I was able to find the sources via the wayback machine.
Unsurprisingly it doesn't build with OCaml 3.11.2 (it wants OCaml 3.06).
Is there a more up to date variant of ocamldefun? Would it be possible
to port it to 3.11.2?

Is it possible to implement ocamldefun-like functionality via Camlp4's
AST filters?

Also is it possible to implement function specialization
(monomorphization?) using an AST filter?
The example from the OCaml tutorial is not optimized by
http://www.ocaml-tutorial.org/performance_and_profiling.

Or is it possible to get access to the OCaml compiler's IL
representation and make optimizations on that?

[*] For example when extracting ML programs from Coq using OCaml's
native 'int' type I get code like this (which is not inlined/optimized
at all by OCaml):
module Z_as_Int =
 struct
....
  let _2 = 2
  let mult = ( * )
...
end
module F =
 functor (I:Int) ->
 struct
  (** val mul2 : I.int -> I.int **)

  let mul2 n =
    I.mult I._2 n
 end
module F2 = F(Z_as_Int)

Best regards,
--Edwin


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

end of thread, other threads:[~2010-05-20 13:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-19 12:58 OCaml defunctorization and other optimizations Török Edwin
2010-05-20  8:41 ` [Caml-list] " Julien Signoles
2010-05-20 11:15   ` Török Edwin
2010-05-20 11:40     ` Julien Signoles
2010-05-20 12:04       ` Török Edwin
2010-05-20 13:16         ` Maxence Guesdon

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