[Haskell-cafe] Strange type behavior in GHCi 6.4.2

Lennart Augustsson lennart at augustsson.net
Sun Dec 31 14:26:24 EST 2006


What Kirsten said.

I think you can be much more productive in optimizing your code
if you actually understand what's going on.  I usually don't go as
far as looking at compiler intermediate code; I usually stick with
profiling (or look at assembly code if it's a really performance
critical inner loop).  Then you can start optimizing.  That can be
by changing algorithm, changing data representation, strictness
annotations, etc.  It can also be by inserting some INLINE or SPECIALIZE
pragmas, but that's more rare (don't get me wrong about those pragmas,
I introduced them in Haskell with hbc).  But I think just adding pragmas
willy-nilly is a bad idea; I find that most serious performance problems
cannot be solved by those means, instead you need a higher level  
approach.

	-- Lennart

On Dec 31, 2006, at 11:47 , Kirsten Chevalier wrote:

> On 12/31/06, Bulat Ziganshin <bulat.ziganshin at gmail.com> wrote:
>> this don't say anything place. and these rules have their own  
>> source: it's
>> hard to optimize using your path. but when program optimization is  
>> just
>> adding a few options/pragmas to the program, it' becomes cheap  
>> enough to
>> change these rules. didn't you thought about it?
>>
>
> In my experience, adding pragmas and toying with options without
> insight into what they do is not "cheap", because it takes up the
> programmer's time, and time is more important than anything else.
> Every minute spent typing in pragmas is a minute lost that could have
> been spent thinking about how to write your code more elegantly, and
> in my experience -- and again, maybe it's just that I'm slow -- adding
> pragmas doesn't help. When it comes to inlining and specializing, GHC
> tends to be smarter than I am. (Once more, maybe it's just that I'm
> slow.) I'd rather focus my energies on doing the things GHC can't
> (usually) do, like replacing an O(n^2) algorithm with an O(log n)
> algorithm.
>
> Cheers,
> Kirsten
>
> -- 
> Kirsten Chevalier* chevalier at alum.wellesley.edu *Often in error,  
> never in doubt
> "Happy is all in your head / When you wake up and you're not dead /  
> It's a
> sign of maturation / That you've lowered your expectations..."-- 
> Barbara Kessler
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list