Recursive functions and constant parameter closures (inlining/strictness analyzer question)

Tyson Whitehead twhitehead at gmail.com
Mon Jun 23 10:31:13 EDT 2008


On Friday 20 June 2008 21:34:14 Dan Doel wrote:
> On Friday 20 June 2008, Max Bolingbroke wrote:
> > Of course, if you have any suggestions for good heuristics based on
> > your benchmarking experience then we would like to hear them! There
> > was some discussion of this in the original ticket,
> > http://hackage.haskell.org/trac/ghc/ticket/888, but when implementing
> > SAT I tried out the suggestions made there without good results
> > (though to be perfectly honest I didn't really understand the
> > motivations behind some of the suggestions made).
>
> However, if I had to pick something out of the air, I'd say this: always do
> SAT when the argument in question is a function. This is actually the
> reason I started doing it in the first place. I was working on sorting
> uvectors, and had what I thought was pretty good performance, and then I
> did SAT on the comparison function, and suddenly my code was running in
> half the time. Going back to my sorting (testing on introsort), SAT for the
> array doesn't seem to do much, but undoing the SAT for the comparison
> function causes heap allocation to balloon, and everything gets at least a
> factor of 2 slower.

I've been wondering if a nice option would be to be able to feed profiler 
information in at compile time and have it override the heuristics.

That way, inlining, specialization, SAT, etc., decisions could be made based 
on how the code actually gets used during a typical run of the program.

Cheers!  -Tyson






More information about the Glasgow-haskell-users mailing list