Re: Re[2]: [Haskell-cafe] Fusing foldr's

2007-10-30 Thread Josef Svenningsson
On 10/29/07, Bulat Ziganshin [EMAIL PROTECTED] wrote: you may also look at these data: 1,225,416 bytes allocated in the heap 152,984 bytes copied during GC (scavenged) 8,448 bytes copied during GC (not scavenged) 86,808 bytes maximum residency (1 sample(s)) 3

Re[4]: [Haskell-cafe] Fusing foldr's

2007-10-30 Thread Bulat Ziganshin
Hello Josef, Tuesday, October 30, 2007, 4:13:04 PM, you wrote: 201,080,832 bytes maximum residency (9 sample(s)) 1681 collections in generation 0 ( 1.67s) 9 collections in generation 1 ( 13.62s) 184,320 bytes maximum residency (2 sample(s)) 1908 collections in

Re: [Haskell-cafe] Fusing foldr's

2007-10-29 Thread Josef Svenningsson
On 10/28/07, Isaac Dupree [EMAIL PROTECTED] wrote: Josef Svenningsson wrote: Less bogus timing: avg4: 18.0s avgS: 2.2s avgP: 17.4s OK, so these figures make an even stronger case for my conclusion :-) Single traversal can be much faster than multiple traversals *when done right*.

Re: [Haskell-cafe] Fusing foldr's

2007-10-29 Thread Josef Svenningsson
On 10/29/07, Josef Svenningsson [EMAIL PROTECTED] wrote: But using those flags yielded a very interesting result: avgP: 4.3s Superlinear speedup!? As you say, I would have expected something slightly larger than 9s. I think what happens here is that for avg4 the entire list has to be kept

Re[2]: [Haskell-cafe] Fusing foldr's

2007-10-29 Thread Bulat Ziganshin
Hello Josef, Monday, October 29, 2007, 2:08:54 PM, you wrote: that can maybe account for the additional time savings. I'm not sure how to verify that this is the case though. Bulat kindly suggested I use +RTS -s to monitor the garbage collectors behavior. It seems my hypothesis was right.

Re: [Haskell-cafe] Fusing foldr's

2007-10-27 Thread Josef Svenningsson
On 10/26/07, Dan Weston [EMAIL PROTECTED] wrote: Thanks for letting me know about the Data.Strict library on Hackage. I will definitely make use of that! BTW, you left out an import Data.List(foldl') in your example. Yes, Data.Strict can be pretty handy for getting the right strictness. Sorry

Re: [Haskell-cafe] Fusing foldr's

2007-10-27 Thread Isaac Dupree
Josef Svenningsson wrote: Less bogus timing: avg4: 18.0s avgS: 2.2s avgP: 17.4s OK, so these figures make an even stronger case for my conclusion :-) Single traversal can be much faster than multiple traversals *when done right*. Did you use +RTS -N2 on your program (or whatever it is that

Re: [Haskell-cafe] Fusing foldr's

2007-10-26 Thread Josef Svenningsson
Sorry for reacting so late on this mail. I'm digging through some old mails... On 10/12/07, Dan Weston [EMAIL PROTECTED] wrote: Always check optimizations to make sure they are not pessimizations! Actually, traversing the list twice is very cheap compared to space leakage, and accumulating

Re: [Haskell-cafe] Fusing foldr's

2007-10-26 Thread Dan Weston
Thanks for letting me know about the Data.Strict library on Hackage. I will definitely make use of that! BTW, you left out an import Data.List(foldl') in your example. My timing test is an order of magnitude worse than yours. Do you have an extra zero in your list endpoint? I fed these

Re: [Haskell-cafe] Fusing foldr's

2007-10-12 Thread Dan Weston
Always check optimizations to make sure they are not pessimizations! Actually, traversing the list twice is very cheap compared to space leakage, and accumulating pairs requires tuple boxing and unboxing which I don't know how to get GHC not to do. Your avg3 (along with several attempts of

[Haskell-cafe] Fusing foldr's

2007-10-11 Thread Tim Newsham
Just goofing around with arrows and foldr while reading Hutton's excellent paper on folds (http://www.cs.nott.ac.uk/~gmh/fold.pdf). Wondering if this can be done automatically and more generally? module Main where import Control.Arrow import Data.List -- sum and length expressed as foldr. fsum