On 02.02.2009, at 16:35, Gregory Petrosyan wrote: > Althrough I am new to Clojure, I like it a lot. Because it is > advertised as native JVM language, I expected it to demostrate decent > performance in simple numeric tests, so I decided to compare it to > Python. > > Clojure rev. 1173: > user=> (defn fac [#^Integer n] (reduce * (range 1 (+ 1 n)))) > #'user/fac > user=> (time (reduce + (map fac (range 1000)))) > "Elapsed time: 944.798019 msecs"
Timing on the JVM is notoriously difficult. Since good performance depends on the JIT compiler, you can't expect anything to be fast the first time you run it. So, define a function that runs your benchmark and run it several times. But even then, microbenchmarks are not the JVM's strongest point. Konrad. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---