Re: [Haskell-cafe] benchmarking pure code

2010-04-01 Thread Paul Brauner
Ok, thank you for all your answers. I'm going to use NFData as advised by everyone. Paul On Wed, Mar 31, 2010 at 10:38:50AM -0700, Bryan O'Sullivan wrote: > On Wed, Mar 31, 2010 at 4:12 AM, Paul Brauner wrote: > > > Thank you, I will look at that. But it seems that criterion uses NFData no? > >

Re: [Haskell-cafe] benchmarking pure code

2010-03-31 Thread Bryan O'Sullivan
On Wed, Mar 31, 2010 at 4:12 AM, Paul Brauner wrote: > Thank you, I will look at that. But it seems that criterion uses NFData no? > I do not know of anything wrong with NFData. What you're seeing is much more likely to be a bug in either the benchmarking library you're using, or in your use of

Re: [Haskell-cafe] benchmarking pure code

2010-03-31 Thread Paul Brauner
Thank you, I will look at that. But it seems that criterion uses NFData no? Paul On Wed, Mar 31, 2010 at 12:57:20PM +0200, Bas van Dijk wrote: > On Wed, Mar 31, 2010 at 11:06 AM, Paul Brauner wrote: > > data Term = Lam Term | App Term Term | Var Int > > > > instance NFData where > >  rnf (Lam t)

Re: [Haskell-cafe] benchmarking pure code

2010-03-31 Thread Bas van Dijk
On Wed, Mar 31, 2010 at 12:57 PM, Bas van Dijk wrote: > main = let !t = genterm in defaultMain [bench "subst" $ nf (subst u) t] Oops, that should be: main = let t = genterm in rnf t `seq` defaultMain [bench "subst" $ nf (subst u) t] Bas ___ Haskell-Ca

Re: [Haskell-cafe] benchmarking pure code

2010-03-31 Thread Bas van Dijk
On Wed, Mar 31, 2010 at 11:06 AM, Paul Brauner wrote: > data Term = Lam Term | App Term Term | Var Int > > instance NFData where >  rnf (Lam t)     = rnf t >  rnf (App t1 t2) = rnf t1 `seq` rnf t2 >  rnf (Var x)     = rnf x > > the actual datatype doesn't have fancy stuff like higher-order > types

Re: [Haskell-cafe] benchmarking pure code

2010-03-31 Thread Paul Brauner
Hello, actually I don't know if I can. I totally wouldn't mind but this is mainly my co-author work and I don't know if he would (I suppose not but since he is sleeping right now I can't check). However let's assume it's a deBruijn representation for instance, I can tell you the scheme I used: da

Re: [Haskell-cafe] benchmarking pure code

2010-03-31 Thread Bas van Dijk
On Wed, Mar 31, 2010 at 9:17 AM, Paul Brauner wrote: > Does anyone have an idea why calling rnf before the bench > doesn't seem to "cache" the result as calling show does? > (my instances of NFData follow the scheme described in strictbench > documentation). Is it possible you could show us your

Re: [Haskell-cafe] benchmarking pure code

2010-03-31 Thread Edward Z. Yang
Excerpts from Paul Brauner's message of Wed Mar 31 03:17:02 -0400 2010: > The part I want to benchmark is 2. In particular I would like that: > > a. \x.t is already evaluated when I run 2 (I don't want to measure the > performances of the generator) > b. the action of substituting u for x in

[Haskell-cafe] benchmarking pure code

2010-03-31 Thread Paul Brauner
Hello, I'm writing a library for dealing with binders and I want to benchmark it against DeBruijn, Locally Nameless, HOAS, etc. One on my benchmark consists in 1. generating a big term \x.t 2. substituting u fox in t The part I want to benchmark is 2. In particular I would like that: a.