English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-05-03 (16:36)
From: Julien Signoles <Julien.Signoles@l...>
Subject: Re: [Caml-list] Functors
> Wow, ok. So ocamldefun maps ocaml code with functors onto ocaml code without
> functors and, according to their examples, this can result in an 8 times
> performance improvement due to inlining.

As far as I test ocamldefun, performance improvement is very dependent of
the application. Mainly, the defunctorized code is generally much more
efficient than the code with functors if
(1) some functions are not inlined due to functors; and
(2) these functions are called very often.
Generally, in the others case, the defunctorization do not improve
performance a lot.

> This begs the question: why is this functionality not in the compiler? In
> fact, using functors with the current compiler actually reduces
> performance...

Some SML compilers include a defunctorizer... But, in a lot of cases,
functors do not reduce performance a lot (as explained above). Morever,
static analysis tools do not generally correctly work on functorized
programs: so a source-to-source defunctorizer as ocamldefun can be used
by these tools while a defunctorizer directly included in the compiler
cannot. So i'm not sure including a defunctorizer in the compiler is a
good thing...

Julien Signoles
mailto:Julien.Signoles@lri.fr ; http://www.lri.fr/~signoles
"In theory, practice and theory are the same,
but in practice they are different" (Larry McVoy)

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