Re: [Haskell-cafe] Performance Issue

2010-05-22 Thread Ozgur Akgun
Richard, I found this very annoying when I first realised GHC doesn't do any CSE, given that the result of pure functions only depend on their parameters. Even though CSE usually sounds good, when you ask, they go and find obscure examples in which it causes great trouble :) I think, there

Re: [Haskell-cafe] Performance Issue

2010-05-22 Thread Michael Lesniak
Hello, Even though CSE usually sounds good, when you ask, they go and find obscure examples in which it causes great trouble :) Do you (or others) have any particular mean but understandable example? Cheers, Michael ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Performance Issue

2010-05-22 Thread Ivan Lazar Miljenovic
Michael Lesniak mlesn...@uni-kassel.de writes: Even though CSE usually sounds good, when you ask, they go and find obscure examples in which it causes great trouble :) Do you (or others) have any particular mean but understandable example?

Re: [Haskell-cafe] Performance Issue

2010-05-22 Thread Michael Lesniak
Hello, http://www.haskell.org/haskellwiki/GHC:FAQ#Does_GHC_do_common_subexpression_elimination.3F All hail Google! :p You're right :D. Thanks! - Michael -- Dipl.-Inf. Michael C. Lesniak University of Kassel Programming Languages / Methodologies Research Group Department of Computer Science

Re: [Haskell-cafe] Performance Issue

2010-05-22 Thread Daniel Fischer
On Saturday 22 May 2010 15:00:25, Thomas Schilling wrote: Actually, in this case it would be safe to do CSS. Because a) the function is strict in both arguments so GHC creates a worker which only uses unboxed types b) this cannot cause any space leaks (it contains no pointers) The

Re: [Haskell-cafe] Performance Issue

2010-05-22 Thread Daniel Fischer
On Saturday 22 May 2010 16:48:27, Daniel Fischer wrote: The boxing is due to the use of (^). If you write x*x instead of x^2, it can use the primop *## and needn't box it. As a side effect, the original time leak probably wouldn't have occured with x*x instead of x^2 because one would've made

Re: [Haskell-cafe] Performance Issue

2010-05-22 Thread Brandon S. Allbery KF8NH
On May 22, 2010, at 08:30 , Ozgur Akgun wrote: Even though CSE usually sounds good, when you ask, they go and find obscure examples in which it causes great trouble :) They're not actually that obscure. Most of them can be summarized thusly: anything that would cause a fold to cause a

Re: [Haskell-cafe] Performance Issue

2010-05-22 Thread Thomas Schilling
On 22 May 2010 16:06, Daniel Fischer daniel.is.fisc...@web.de wrote: On Saturday 22 May 2010 16:48:27, Daniel Fischer wrote: The boxing is due to the use of (^). If you write x*x instead of x^2, it can use the primop *## and needn't box it. As a side effect, the original time leak probably

[Haskell-cafe] Performance Issue

2010-05-18 Thread Richard Warburton
A colleague of mine pointed out that ghc wasn't performing as he expected when optimising some code. I wonder if anyone could offer any insight as to why its not noting this common subexpression: main = print $ newton 4 24 newton a 0 = a newton a n = ((newton a (n-1))^2 + a)/(2*(newton a

Re: [Haskell-cafe] Performance Issue

2010-05-18 Thread Bryan O'Sullivan
On Tue, May 18, 2010 at 9:30 AM, Richard Warburton richard.warbur...@gmail.com wrote: A colleague of mine pointed out that ghc wasn't performing as he expected when optimising some code. I wonder if anyone could offer any insight as to why its not noting this common subexpression: GHC

Re: [Haskell-cafe] Performance Issue

2010-05-18 Thread Richard Warburton
A colleague of mine pointed out that ghc wasn't performing as he expected when optimising some code.  I wonder if anyone could offer any insight as to why its not noting this common subexpression: GHC performs almost no common subexpression elimination, the reasons being that it can

Re: [Haskell-cafe] Performance Issue

2010-05-18 Thread Serguey Zefirov
2010/5/18 Richard Warburton richard.warbur...@gmail.com: GHC performs almost no common subexpression elimination, the reasons being that it can introduce space leaks and undesired extra laziness. Is there any way to encourage it to do so, for example compilation flags?  Or is it generally best

Re: [Haskell-cafe] Performance Issue

2010-05-18 Thread Bryan O'Sullivan
On Tue, May 18, 2010 at 9:43 AM, Richard Warburton richard.warbur...@gmail.com wrote: Is there any way to encourage it to do so, for example compilation flags? No. It would be difficult for the compiler to see when CSE is or is not safe to apply, and so it doesn't have any code to perform

[Haskell-cafe] performance issue and HGL

2010-02-14 Thread Vojtěch Knyttl
Hello, I've created a simple Mandelbrot set generator, using HGL, the source is viewable at: http://pastebin.dqd.cz/cUmg/ 1. The problem is, that it is very slow. It is obvious that what takes the most time is the mandel function computation. I have no idea, how it can be improved. 2. What

[Haskell-cafe] Performance Issue

2009-02-26 Thread James Swaine
i'm implementing a benchmark which includes a detailed specification for a random number generator. for any of the kernels outlined in the benchmark, i might have to generate a set of random numbers R, which has a length n, using the following formulas: R[k] = ((2^-46)(X[k])) mod 2^46, where

Re: [Haskell-cafe] Performance Issue

2009-02-26 Thread Don Stewart
james.swaine: i'm implementing a benchmark which includes a detailed specification for a random number generator. for any of the kernels outlined in the benchmark, i might have to generate a set of random numbers R, which has a length n, using the following formulas: R[k] = ((2^-46)(X[k]))

Re: [Haskell-cafe] Performance Issue

2009-02-26 Thread Luke Palmer
2009/2/26 James Swaine james.swa...@gmail.com --gets r[k], which is the value at the kth --position in the overall sequence of --pseudorandom numbers getRandAt :: Int64 - Int64 - Float getRandAt 0 seed = multiplier * (fromIntegral seed) getRandAt k seed = multiplier * (fromIntegral x_next)

Re: [Haskell-cafe] Performance Issue

2009-02-26 Thread Daniel Fischer
Am Donnerstag, 26. Februar 2009 18:48 schrieb Luke Palmer: 2009/2/26 James Swaine james.swa...@gmail.com --gets r[k], which is the value at the kth --position in the overall sequence of --pseudorandom numbers getRandAt :: Int64 - Int64 - Float getRandAt 0 seed = multiplier *