caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Local functions with arguments or closures ?
@ 2012-06-07 17:34 Daniel Bünzli
  2012-06-07 18:54 ` Yitzhak Mandelbaum
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Daniel Bünzli @ 2012-06-07 17:34 UTC (permalink / raw)
  To: caml-list

Hello, 

In the past I remember having indirectly benchmarked two different styles for writing local functions :

    let f x = 
      let v = ... in
      let rec loop x v = ... in 
      loop x v 

or 

    let f x = 
        let v = ... in
        let rec loop () = ... (* uses v and x *) in 
        loop ()

without being able to reach a conclusion. Is there any particular style that is definitively faster ? Does it maybe depend on the number of arguments and/or on whether loop is recursive or not ? 

This question keeps coming back in my mind when I write local functions... I'm sure someone with some knowledge of the compiler's internals can provide a more reasonable answer than benchmarks.  

Best,

Daniel





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

end of thread, other threads:[~2012-06-16 23:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-07 17:34 [Caml-list] Local functions with arguments or closures ? Daniel Bünzli
2012-06-07 18:54 ` Yitzhak Mandelbaum
2012-06-07 19:07 ` Gabriel Scherer
2012-06-07 20:09   ` AW: " Gerd Stolpmann
2012-06-07 22:10     ` Alain Coste
2012-06-07 23:45 ` Ville-Pertti Keinonen
2012-06-16 23:14 ` Goswin von Brederlow

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