[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2004-05-02 (14:12) |
From: | skaller <skaller@u...> |
Subject: | Re: [Caml-list] Functors |
On Sun, 2004-05-02 at 23:34, Jon Harrop wrote: > On Sunday 02 May 2004 11:24, Martin Jambon wrote: > > On Sun, 2 May 2004, Jon Harrop wrote: > > > Functors appear to be somewhat similar to templates in C++. Does the > > > functor approach produce more efficient code as it is partially > > > specialised over the comparison function? > > > > Unfortunately no. > > ... > > http://www.lri.fr/~signoles/ocamldefun/manual.html > > 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. > > This begs the question: why is this functionality not in the compiler? In > fact, using functors with the current compiler actually reduces > performance... The answer is separate compilation. When you instantiate a Set.Make .. you only have the interface. Hard to inline without actually having the body of the functor.. -- John Skaller, mailto:skaller@users.sf.net voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net ------------------- 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