[Haskell-cafe] Dead else branch does influence runtime?

2011-06-14 Thread Johannes Waldmann
Dear all, I am very puzzled by a program that contains an else branch that is never executed, but still seems to slow down the program. (When I replace it by undefined, the resulting program runs much faster.) http://hackage.haskell.org/trac/ghc/ticket/5256 I thought it may be a type issue

Re: [Haskell-cafe] Dead else branch does influence runtime?

2011-06-14 Thread Daniel Fischer
On Tuesday 14 June 2011, 14:35:19, Johannes Waldmann wrote: Dear all, I am very puzzled by a program that contains an else branch that is never executed, but still seems to slow down the program. (When I replace it by undefined, the resulting program runs much faster.)

Re: [Haskell-cafe] Dead else branch does influence runtime?

2011-06-14 Thread Johannes Waldmann
Thanks for the analysis. So is this a problem that should be fixed in GHC? And what can I do to circumvent the problem? (Perhaps write some RULES magic?) Thanks - J.W. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Dead else branch does influence runtime?

2011-06-14 Thread KC
How is the compiler to know the else branch is never executed at run-time? If you do, then why is it there in your source code? On Tue, Jun 14, 2011 at 7:35 AM, Johannes Waldmann waldm...@imn.htwk-leipzig.de wrote: Thanks for the analysis. So is this a problem that should be fixed in GHC?

Re: [Haskell-cafe] Dead else branch does influence runtime?

2011-06-14 Thread Johannes Waldmann
On 06/14/2011 04:42 PM, KC wrote: How is the compiler to know the else branch is never executed at run-time? If you do, then why is it there in your source code? The algorithm is divide-and-conquer, and I want to create sparks as long as I have cores (capabilities), and use the linear algorithm

Re: [Haskell-cafe] Dead else branch does influence runtime?

2011-06-14 Thread Daniel Fischer
On Tuesday 14 June 2011, 15:51:57, Daniel Fischer wrote: On Tuesday 14 June 2011, 14:35:19, Johannes Waldmann wrote: With id, main1 jumps to foldb_cap, which contains a lot of code for the (cap 1)-branch, and - that's what causes the slowdown - a worker loop $s$wfoldlM'_loop_s3EE

Re: [Haskell-cafe] Dead else branch does influence runtime?

2011-06-14 Thread Johannes Waldmann
On 06/14/2011 04:51 PM, Daniel Fischer wrote: Note that you get good behaviour when you help GHC a bit, in particular a static argument transformation Great! And just in time for my lecture ... - Thanks, J.W. signature.asc Description: OpenPGP digital signature

Re: [Haskell-cafe] Dead else branch does influence runtime?

2011-06-14 Thread KC
Superb; on how to avoid boxing. On Tue, Jun 14, 2011 at 7:51 AM, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: On Tuesday 14 June 2011, 15:51:57, Daniel Fischer wrote: On Tuesday 14 June 2011, 14:35:19, Johannes Waldmann wrote: With id, main1 jumps to foldb_cap, which contains a lot