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

Max Bolingbroke batterseapower at
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 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
( 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
iteration count.


More information about the Glasgow-haskell-users mailing list