On Thu, 1 Jul 2010 19:51:06 +0200 Peter Schuller <peter.schul...@infidyne.com> wrote:
> > Is anyone using anything more sophisticated than clojure.core/time for > > benchmarking clojure code? > > No, but last time I thought about this I figured a very simple > (benchmark ...) would simply: > > * Iterate with exponentially higher repeat counts until total runtime > reaches >= 1 second (say). > * Then, iterate with the same count until the timing over some period, > say 10 seconds, has a sufficiently low standard deviation. > * Then, take that repeat count and re-run enough to reach, say, 10 > seconds, of time. > > Obviously the 1, 10 and std dev thesholds would be selectable, with > some default. So that in the normal case for micro-benchmarking, you'd > just do: > > (benchmark (run-my-stuff)) > > And it would usually "just work" even if run-my-stuff is a trivial > function that completes really really quickly (due to the exponential > growth). > > Thoughts? It's obviously not meant for really serious benchmarking, > but I think it would be a good thing to have in cases where one might > now otherwise use (time ..). This is pretty much where I was heading when I started writing those two macros. Wanting to be able to time very short runtimes without timing the loop, I wrote loop-timer to deal with loop overhead. Only to have it return negative values in the process of trying to get a reasonable total run time. This makes that process, um, interesting. <mike -- Mike Meyer <m...@mired.org> http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org -- 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