From: "Török Edwin" <edwintorok@gmail.com>
To: caml-list@yquem.inria.fr
Subject: OCaml defunctorization and other optimizations
Date: Wed, 19 May 2010 15:58:25 +0300 [thread overview]
Message-ID: <4BF3E071.9040901@gmail.com> (raw)
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
next reply other threads:[~2010-05-19 12:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-19 12:58 Török Edwin [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BF3E071.9040901@gmail.com \
--to=edwintorok@gmail.com \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox