Questions tagged [haskell-criterion]

Criterion is a library for benchmarking Haskell code. For questions related to (N)Hibernate Criteria, use the [criteria] tag.

Links

46 questions
18
votes
1 answer

Benchmarking Filter and Partition

I was testing the performance of the partition function for lists and got some strange results, I think. We have that partition p xs == (filter p xs, filter (not . p) xs) but we chose the first implementation because it only performs a single…
aesadde
  • 439
  • 3
  • 9
15
votes
1 answer

How to use Criterion to measure performance of Haskell programs?

I'm trying to measure the performance of a simple Haar DWT program using the Criterion framework. (It is erroneously slow, but I'll leave that for another question). I can't find any good documentation on the web, unfortunately. My two primary…
gatoatigrado
  • 16,580
  • 18
  • 81
  • 143
15
votes
1 answer

How to reliably compare runtime of Haskell and C?

I used Criterion library to write benchmarks for my Haskell functions. Now I am implementing the same algorithm in C to compare performance with Haskell. The question is how can I do it reliably? Criterion does a lot of fancy stuff like accounting…
Jan Stolarek
  • 1,409
  • 1
  • 11
  • 21
15
votes
2 answers

How do I get consistent criterion benchmarks, or interpret results across runs?

I'm trying to optimize some code, using criterion to try to compare, for example, the effect of adding INLINE pragma to a function. But I'm finding results are not consistent between re-compiles/runs. I need to know how to get results either to be…
jberryman
  • 16,334
  • 5
  • 42
  • 83
13
votes
1 answer

Cross module optimizations in GHC

I have a non-recursive function to calculate longest common subsequence that seems to perform well (ghc 7.6.1, compiled with -O2 -fllvm flags) if I measure it with Criterion in the same module. On the other hand, if I convert the function into a…
Sal
  • 4,312
  • 1
  • 17
  • 26
11
votes
3 answers

Generating HTML output from criterion

There is a nice example of HTML output from criterion at http://bos.github.com/criterion/. Which command line option is used to generate this output? An answer to a related question asserts that this output exits, but it does not seem to show up in…
danr
  • 2,405
  • 23
  • 24
10
votes
1 answer

Run Haskell benchmarks on inputs of varying size

Often I’d like to compare the runtime performance of multiple implementations of the same function. For individual inputs, criterion is a good tool. But what is an easy way to plot the performance of the code over varying input size, e.g. to see the…
10
votes
2 answers

How to create data for Criterion benchmarks?

I am using criterion to benchmark my Haskell code. I'm doing some heavy computations for which I need random data. I've written my main benchmark file like this: main :: IO () main = newStdGen >>= defaultMain . benchmarks benchmarks :: RandomGen g…
Jan Stolarek
  • 1,409
  • 1
  • 11
  • 21
8
votes
2 answers

Command line options picked up by criterion library

I have used the libraries criterion and cmdargs. When I compile the program completely without cmdargs and run it e.g. ./prog --help then I get some unwanted response from criterion about the possible options and the number of runs etc.. When I…
J Fritsch
  • 3,338
  • 1
  • 18
  • 40
8
votes
1 answer

Scala criterion equivalent

Is there a Scala (or Java, I guess) equivalent of criterion? I'm not just talking about a benchmarking library: check out what criterion does for HTML results.
Ptharien's Flame
  • 3,246
  • 20
  • 24
7
votes
1 answer

Forcing evaluation of function input before benchmarking in Criterion

How do you force evaluation of the input of a function before benchmarking the function in Criterion? I am trying to benchmark some functions, but will like to exclude time to evaluate input thunk. The code in question uses unboxed vectors for…
Sal
  • 4,312
  • 1
  • 17
  • 26
7
votes
2 answers

Graphing criterion benchmarks taking different orders of magnitude of time

I have a Criterion benchmark where each bgroup corresponds to a test, and within each bgroup there are two bench values of the test with different options. For example: main = defaultMain [bgroup "test1" [bench "v1" test1_1, bench "v2" test1_2] …
Neil Mitchell
  • 9,090
  • 1
  • 27
  • 85
6
votes
1 answer

capabilities of criterion

I found some old examples of the use of criterion here. It looks as if back in 2009 it was supporting command line options for drawing graphs. Now, when I import criterion 0.6, wrap it in a basic application (to test it) and say ./application --help…
J Fritsch
  • 3,338
  • 1
  • 18
  • 40
5
votes
1 answer

Haskell benchmarking/Optimization of nf/whnf of non-strict reduction

I am trying to optimize a library which is designed to take a large data set and then apply different operations to it. Now that the library is working, I want to optimize it. I am under the impression that non-strict evaluation allows GHC to…
Toymakerii
  • 1,510
  • 2
  • 12
  • 26
5
votes
2 answers

How to use criterion with stack

I set up a simple stack project, and a .cabal entry for the benchmark tests: benchmark leaves-of-a-tree-bench type: exitcode-stdio-1.0 hs-source-dirs: src, bench main-is: MainBenchmarkSuite.hs build-depends: base …
Damian Nadales
  • 4,907
  • 1
  • 21
  • 34
1
2 3 4