[Haskell-cafe] efficient combination of foldl' and foldr -> foldl'r

2008-12-05 Thread Henning Thielemann
I want to do a foldl' and a foldr in parallel on a list. I assumed it would be no good idea to run foldl' and foldr separately, because then the input list must be stored completely between the calls of foldl' and foldr. I wanted to be clever and implemented a routine which does foldl' and fo

Re: [Haskell-cafe] efficient combination of foldl' and foldr -> foldl'r

2008-12-05 Thread Ryan Ingram
You're testing the interpreted code, so it's not surprising that the naive version performs better; the interpretive overhead only applies to your bit of glue code. So, you've succeeded in showing that compiled code performs better than interpreted code, congratulations! :) A better test would be

Re: [Haskell-cafe] efficient combination of foldl' and foldr -> foldl'r

2008-12-05 Thread Henning Thielemann
On Fri, 5 Dec 2008, Ryan Ingram wrote: You're testing the interpreted code, so it's not surprising that the naive version performs better; the interpretive overhead only applies to your bit of glue code. I wanted to avoid the optimizer to do clever things itself. Alternatively, at least com

Re: [Haskell-cafe] efficient combination of foldl' and foldr -> foldl'r

2008-12-05 Thread Joachim Breitner
Hi, Am Freitag, den 05.12.2008, 23:43 +0100 schrieb Henning Thielemann: > > ryani$ ghci foldlr.hs > > [...] > > Prelude FoldLR> :set +s > > Prelude FoldLR> test > > (100,'a') > > (0.39 secs, 70852332 bytes) > > Prelude FoldLR> testNaive > > (100,'a') > > (0.42 secs, 105383824 bytes) > > T