Re: equivalent of EXPLAIN PLAN with GHC?

2009-08-03 Thread Joshua Haberman
Don Stewart dons at galois.com writes: joshua: Is there any kind of intermediate form that a person can examine to see how their code is being optimized? Anything like EXPLAIN PLAN in SQL? It would make it much easier to understand the kinds of optimizations Haskell can perform. I'm

equivalent of EXPLAIN PLAN with GHC?

2009-08-02 Thread Joshua Haberman
Hello, I'm quite new to Haskell, but experienced in other languages (C, Python, Ruby, SQL, etc). I am interested in Haskell because I've heard that the language is capable of lots of optimizations based on laziness, and I want to learn more about that. I dug in with Project Euler problem #1, and

Re: equivalent of EXPLAIN PLAN with GHC?

2009-08-02 Thread Thomas DuBuisson
Josh, In general you'll find the haskell-cafe (haskell-c...@haskell.org) to be a more lively place for this type of discussion, but since we're here I might as well mention that memory use of a Haskell function is one of the hardest things to gain an understanding about. main = print (show (sum

Re: equivalent of EXPLAIN PLAN with GHC?

2009-08-02 Thread Joshua Haberman
Hi Thomas, thanks for the reply! Thomas DuBuisson thomas.dubuisson at gmail.com writes: Josh, In general you'll find the haskell-cafe (haskell-cafe at haskell.org) to be a more lively place for this type of discussion Good to know, I just wasn't sure if it was appropriate for GHC-specific

Re: equivalent of EXPLAIN PLAN with GHC?

2009-08-02 Thread Don Stewart
joshua: Hello, I'm quite new to Haskell, but experienced in other languages (C, Python, Ruby, SQL, etc). I am interested in Haskell because I've heard that the language is capable of lots of optimizations based on laziness, and I want to learn more about that. I dug in with Project Euler

Re[2]: equivalent of EXPLAIN PLAN with GHC?

2009-08-02 Thread Bulat Ziganshin
Hello Joshua, Sunday, August 2, 2009, 11:45:57 AM, you wrote: 94,604 bytes allocated in the heap Is there any way I could find out what these 94kb of RAM were allocated for? This seems high -- my entire program's working set is 6kb. as Don said, compiled code works on Int#

Re: equivalent of EXPLAIN PLAN with GHC?

2009-08-02 Thread Don Stewart
bulat.ziganshin: Hello Joshua, Sunday, August 2, 2009, 11:45:57 AM, you wrote: 94,604 bytes allocated in the heap Is there any way I could find out what these 94kb of RAM were allocated for? This seems high -- my entire program's working set is 6kb. as Don said,

Re: equivalent of EXPLAIN PLAN with GHC?

2009-08-02 Thread Don Stewart
dons: Showing what transformations happened. Notably, 2 occurences of the streamU/unstreamU transformation, to remove intermediate structures. The final code looks like: $s$wfold :: Int# - Int# $s$wfold = \ (sc_s19l :: Int#) - case modInt# (-9223372036854775807) 3 of