2009/12/14 jan <jan.mare...@gmail.com>:
> Shawn Hoover <shawn.hoo...@gmail.com> writes:
>> I see usages of the time macro that wrap the expression of interest in a call
>> to dotimes. Is there any interest in an overload of time that takes an
>> additional parameter for a number of iterations, evaluates the expression 
>> that
>> many times, and prints the average time in the report?
>>
>> Usage:
>> user> (time 10 (* 21 2))
>> "Elapsed time: 0.201 msecs, Average: 0.0201 msecs"
>> 42
>> user>
>
> I think this is a bad idea, read this article for reasons why
>
> http://www.ibm.com/developerworks/java/library/j-benchmark1.html

There's a really cool Haskell benchmarking library called Criterion
which tries to follow the advice from the Developer Works articles (I
thought Bryan linked to the IBM articles from his blog, but I can't
find the link any more...) [1].

The idea is that you pass in an expression that you want to benchmark
and Criterion will try to figure out how to get statistically relevant
results out of it. This includes figuring out the timer resolution on
the underlying platform, how expensive it is to call the clock
functions, and running the test an appropriate number of times per
test iteration based on this information. It also prints out pretty
graphs!

Something like this would be really nice in Clojure.

[1] 
http://www.serpentine.com/blog/2009/09/29/criterion-a-new-benchmarking-library-for-haskell/

> jan

-- 
  ! Lauri

-- 
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

Reply via email to