Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Niemeijer, R.A. <r.a.niemeijer <at> tue.nl>
Subject: ANNOUNCE: StrictBench 0.1 - Benchmarking code through strict evaluation
Newsgroups: gmane.comp.lang.haskell.cafe
Date: Monday 8th June 2009 07:20:30 UTC (over 8 years ago)
Hello everyone,

In the last month or so, I've found myself using the following snippet a
lot:

import Control.Parallel.Strategies
import Test.BenchPress

bench 1 . print . rnf

This snippet fully evaluates a value and prints how long it took to do so.
I regularly use it to see where the bottlenecks lie in my algorithms.  It
has the minor annoyance, however, that it prints a lot of information (min,
max, mean, median, percentiles) that is all identical, because I only run
it once. The reason I only run it once is that I'm typically evaluating a
pure value, which means that any subsequent attempts to benchmark the
evaluation time will take no time at all, since it has already been
evaluated.

To solve this, I decided to write a small library to make this process
easier and only print the time taken once. The result is StrictBench, which
can be found at http://hackage.haskell.org/cgi-bin/hackage-scripts/package/StrictBench.

A short example:

import Test.StrictBench

main = bench [1..10000000 :: Integer]

This code would give

2890.625 ms

as output. For the rest of the documentation I refer you to the Hackage
page.

Regards,
Remco Niemeijer
 
CD: 4ms