Recursive functions and constant parameter closures
(inlining/strictness analyzer question)
batterseapower at hotmail.com
Mon Jun 23 11:10:52 EDT 2008
> 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
Yes, that is the ultimate solution to resolving those things that are
traditionally unknown by a compiler, and profile directed optimization
could certainly be exploited by GHC (imagine having the compiler
automatically run Quickcheck/HUnit tests to exercise the code..). See
http://msdn.microsoft.com/en-us/library/e7k32f4k.aspx for details of a
practical implementation of this strategy. I wouldn't be suprised if
industrial virtual machine JIT compilers were making use of this sort
of thing too.
Another strategy is to having the runtime dynamically adjust how code
is executed based on profiling information. See e.g. Adaptive
Evalution of Non-Strict Programs by Robert Ennals
(http://berkeley.intel-research.net/rennals/pubs/thesis.pdf). In the
case of SAT this might involve the runtime switching to the non-SATed
version of a function if it looks like most calls to it had a low
More information about the Glasgow-haskell-users