Hello, 2009/2/18 CuppoJava <patrickli_2...@hotmail.com>
> > Hi, > I've noticed that I'm creating a lot of maps of functions, and I'm > wondering if there's a performance penalty for this. > > ie. > (defn create_fn [] > (fn [] (println "hi"))) If you use AOT compilation, you'll see that this code will add 2 new classes to the namespace it is declared in : one class for create_fn itself, and one anonymous class for (fn [] (println "hi")) > ((create_fn)) <--- Does this "create" a new function every-time it's > called? Or is the function code cached somewhere? How much of a > performance penalty does this incur? Each call to create_fn will create a new instance (object) of the anonymous class for (fn [] (println "hi")) HTH, -- Laurent > > > Thanks for the help > -Patrick > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---