I'm thinking that integer boxing on the argument to your Fn is perhaps dominating your numbers. I'm not up to date on the compiler, but I'd think that the argument to the direct Math/ceil call is parsed in primitive form.
On Wed, May 20, 2009 at 9:38 PM, CuppoJava <patrickli_2...@hotmail.com> wrote: > > Hi, > I'm using "apply" a lot in my code, and a small micro-benchmark is > telling me that it's a very slow operation. Can someone confirm this? > I'm wondering whether my benchmark is incorrect, or whether there's a > hidden reflection that I'm not seeing. > > Thanks a lot for the help > -Patrick > > (let [i [1]] > (time (dotimes [j 10000000] > (apply #(Math/ceil %) i)))) > > Elapsed Time: 4123.448 msecs > > (let [i 1] > (time (dotimes [j 10000000] > (Math/ceil i)))) > > Elapsed Time: 555.107 msecs > > > -- Venlig hilsen / Kind regards, Christian Vest Hansen. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---