Re: [Haskell-cafe] optimization of recursive functions

2013-02-15 Thread Andrew Polonsky
Thanks for the exhaustive answer. Andrew On Wed, Feb 13, 2013 at 2:57 PM, Alp Mestanogullari alpmes...@gmail.comwrote: If a difference appears, I believe http://blog.johantibell.com/2010/09/static-argument-transformation.htmlwould be involved. Also, the second map function could be inlined

[Haskell-cafe] optimization of recursive functions

2013-02-13 Thread Andrew Polonsky
Hello, Is there any difference in efficiency between these two functions, when compiled with all optimizations? map f [] = [] map f (a:as) = f a : map f as and map f x = map' x where map' [] = [] map' (a:as) = f a : map' as Thanks, Andrew ___

Re: [Haskell-cafe] optimization of recursive functions

2013-02-13 Thread Alp Mestanogullari
If a difference appears, I believe http://blog.johantibell.com/2010/09/static-argument-transformation.htmlwould be involved. Also, the second map function could be inlined by GHC, avoiding calling f through a pointer because at the call site, we know what 'f' is (this is also mentionned in the

Re: [Haskell-cafe] optimization of recursive functions

2013-02-13 Thread wren ng thornton
On 2/13/13 3:55 AM, Andrew Polonsky wrote: Hello, Is there any difference in efficiency between these two functions, when compiled with all optimizations? map f [] = [] map f (a:as) = f a : map f as and map f x = map' x where map' [] = [] map' (a:as) = f a : map' as As Alp says,