Investigating magic numbers: improving the inlining heuristic in the Glasgow Haskell Compiler

Celeste Hollenbeck, Michael O’Boyle, Michel Steuwer · 2022

Inlining is a widely studied compiler optimization that is particularly important for functional languages such as Haskell and OCaml. The Glasgow Haskell Compiler (GHC) inliner is a heuristic of such complexity, however, that it has not significantly changed for nearly 20 years. It heavily relies on hard-coded numeric constants, or magic numbers, based on out-of-date intuition. Dissatisfaction with inlining performance has led to the widespread use of inlining pragmas by programmers.

Read the paper · More papers on PaperTik