On Jul 1, 7:51 pm, Peter Schuller <peter.schul...@infidyne.com> wrote: > > Is anyone using anything more sophisticated than clojure.core/time for > > benchmarking clojure code?
Criterium, a benchmarking library for Clojure, seems pretty good: http://github.com/hugoduncan/criterium Based on ideas in this article: http://www.ibm.com/developerworks/java/library/j-benchmark1.html The stackoverflow question where I found it, thanks to Michal Marczyk: http://stackoverflow.com/questions/3041299/how-to-benchmark-functions-in-clojure Getting *accurate* results can be hard, even with a benchmarking library. Criterium runs the code 60 times and does statistical analysis on the results, but I can still get variations above +/-10% from run to run in the REPL. I think benchmarking works best when * starting a new run each time - i.e. from the command line, a "clean slate" JVM * having something that runs long enough to stabilize the JVM - Criterium wants 1 min or more total runtime. * running it more than once and checking that results are tolerably consistent * looking for differences in orders of magnitude rather than a couple of percent more or less. I suppose the good news is that differences in orders of magnitude (1x vs 10x vs 100x) tend to stand out and do not need anything particularly scientific apart from running it long enough a few times. -- 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 Note that posts from new members are moderated - please be patient with your first post. 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