Categories
Uncategorized

Natural Selection for Self-Optimizing Haskell Code

I’ve been playing around with Haskell, Clojure, Scala and Mercury recently, and even though Clojure seems to be winning my heart, I’ve found much to admire about each language.  Haskell and Mercury, in particular, are nicely brain-twisty.

The recent release of a new backend for GHC that can generate code for LLVM is quite exciting.  Even more interesting is this blog post by Don Stewart (co-author of Real World Haskell) exploring genetic algorithms (via the Acovea toolkit) to select sets of LLVM compiler optimizations.  The process isn’t fast (Acovea chews on the options for four hours), but the improvements for even these preliminary explorations are striking.  This approach is worth watching; there is a lot of performance waiting to be squeezed out of modern processors, and it’s even better if we can design approaches that allows automatic optimization for each platform. (Don suggests that he’s working on a wrapper library to allow you to simply issue a main = evolve main' and let it go.)

Leave a Reply

Your email address will not be published. Required fields are marked *