Re: [Haskell-cafe] proper way to generate a random data in criterion

2011-10-19 Thread 山本和彦
Greg, > The code looks ok to me -- you've deepseq'ed the list, and forcing it > to whnf should force the deepseq. Also, criterion runs your benchmark > many times, if your code was measuring the RNG time it would only > happen once. This would show up in the criterion output as an > unusually larg

Re: [Haskell-cafe] proper way to generate a random data in criterion

2011-10-19 Thread Henk-Jan van Tuyl
On Wed, 19 Oct 2011 21:21:48 +0200, Gregory Collins wrote: On Wed, Oct 19, 2011 at 5:03 PM, Johan Tibell wrote: It does. You need to use evaluate to have ensure actually be evaluated. I'm almost certain you're wrong about this. The bang pattern on the return from ensure (!r1 <- ensure

Re: [Haskell-cafe] proper way to generate a random data in criterion

2011-10-19 Thread Johan Tibell
On Wed, Oct 19, 2011 at 12:21 PM, Gregory Collins wrote: > On Wed, Oct 19, 2011 at 5:03 PM, Johan Tibell > wrote: > > > > It does. You need to use evaluate to have ensure actually be evaluated. > > > > I'm almost certain you're wrong about this. The bang pattern on the > return from ensure (!r1 <

Re: [Haskell-cafe] proper way to generate a random data in criterion

2011-10-19 Thread Bas van Dijk
On 19 October 2011 17:03, Johan Tibell wrote: > Have a look at: > > https://github.com/tibbe/unordered-containers/blob/master/benchmarks/Benchmarks.hs I see you use the (evaluate . rnf) composition. I also used it in: https://github.com/basvandijk/vector-bytestring/blob/master/bench.hs#L118 an

Re: [Haskell-cafe] proper way to generate a random data in criterion

2011-10-19 Thread Gregory Collins
On Wed, Oct 19, 2011 at 5:03 PM, Johan Tibell wrote: > > It does. You need to use evaluate to have ensure actually be evaluated. > I'm almost certain you're wrong about this. The bang pattern on the return from ensure (!r1 <- ensure $ ...) forces r1 to WHNF, which goes through deepseq, and thus t

Re: [Haskell-cafe] proper way to generate a random data in criterion

2011-10-19 Thread Johan Tibell
Hi, On Wed, Oct 19, 2011 at 1:13 AM, Kazu Yamamoto wrote: > Hello, > > I'm measuring performance of the insertion operation of red-black > trees. For input, three kinds of [Int] are prepared: the increasing > the order, decreasing order, and random. > > The random case is 4 or 5 times slower tha

Re: [Haskell-cafe] proper way to generate a random data in criterion

2011-10-19 Thread Ivan Lazar Miljenovic
On 19 October 2011 19:21, Gregory Collins wrote: > On Wed, Oct 19, 2011 at 10:13 AM, Kazu Yamamoto wrote: >> Hello, >> >> I'm measuring performance of the insertion operation of red-black >> trees. For input, three kinds of [Int] are prepared: the increasing >> the order, decreasing order, and ra

Re: [Haskell-cafe] proper way to generate a random data in criterion

2011-10-19 Thread Gregory Collins
On Wed, Oct 19, 2011 at 10:13 AM, Kazu Yamamoto wrote: > Hello, > > I'm measuring performance of the insertion operation of red-black > trees. For input, three kinds of [Int] are prepared: the increasing > the order, decreasing order, and random. > > The random case is 4 or 5 times slower than the

[Haskell-cafe] proper way to generate a random data in criterion

2011-10-19 Thread 山本和彦
Hello, I'm measuring performance of the insertion operation of red-black trees. For input, three kinds of [Int] are prepared: the increasing the order, decreasing order, and random. The random case is 4 or 5 times slower than the others. I'm afraid that my program also measured the cost of random