Autobahn: using genetic algorithms to infer strictness annotations.
Wang, Yisu Remy.
- Although laziness enables beautiful code, it comes with non-trivial performance costs. The GHC compiler for Haskell has optimizations to reduce those costs, but the optimizations are not sufficient. As a result, Haskell also provides a variety of strictness annotations so that users can indicate program points where an expression should be evaluated eagerly. Skillful use of those annotations is a ... read moreblack art, known only to expert Haskell programmers. In this thesis, I introduce Autobahn, a tool that uses genetic algorithms to automatically infer strictness annotations to improve program performance on represen- tative inputs. Users examine the suggested annotations for soundness and can instruct Autobahn to automatically produce modified sources. Experiments on 60 programs from the NoFib benchmark suite show that Autobahn can infer annotation sets that improve runtime performance by a geometric mean of 8.5%. Case studies show Autobahn can reduce the live size of a GC simulator by 99% and infer application-specific annotations for Aeson library code. A 10-fold cross-validation study shows the Autobahn-optimized GC simulator generally outperforms a version optimized by an expert. To achieve those improvements, Autobahn adds a geometric mean of 24 annotations per 100 LOC. A second pass of genetic algorithms can reduce the average (geo-mean) number of bangs to 16 per 100 LOC, and still produces at least 85 % of the performance improvement from the first pass.read less