Hot Call-Chain Inlining for the Glasgow Haskell Compiler
Inlining is a well-studied compiler transformation that can reduce call overhead and enable further optimizations. As functional programming languages such as Haskell have functions as first-class objects, they potentially have the most to gain from inlining. However, despite being acknowledged as one of the most important optimizations, there has been little recent work to significantly improve Haskell’s inlining heuristic for code performance. This paper proposes a profile-directed technique to direct inlining decisions in the Glasgow Haskell Compiler. We show that simply inlining “hot” functions, as revealed by profiling summaries, does not lead to significant improvement. However, inlining along the hot dynamic call graph is frequently beneficial. Due to the higher-order nature of Haskell, determining this call graph is non-trivial. We develop a technique to extract call chains of hot functions and leverage the Glasgow Haskell Compiler’s existing functionality to safely influence inlining decisions through pragma placement along these chains. We then show that hot call chain inlining yields a geometric mean speedup in run time of 9% over GHC’s default inlining heuristics across 17 real-world Haskell packages. This method can be used in the presence of pre-existing developer pragmas to produce a mean speedup of 10% across those same packages.
Tue 22 OctDisplayed time zone: Pacific Time (US & Canada) change
14:00 - 15:30 | Session 3 on Code OptimizationsGPCE at San Marino Chair(s): Lionel Parreaux HKUST (The Hong Kong University of Science and Technology) | ||
14:00 30mTalk | Type-Safe Code Generation With Algebraic Effects and HandlersDistinguished Research Paper Award GPCE Kanaru Isoda University of Tsukuba, Ayato Yokoyama University of Tsukuba, Yukiyoshi Kameyama University of Tsukuba | ||
14:30 30mTalk | Hot Call-Chain Inlining for the Glasgow Haskell Compiler GPCE | ||
15:00 30mTalk | Restaging Domain-Specific Languages: A Flexible Design Pattern for Rapid Development of Optimizing Compilers GPCE Amir Shaikhha University of Edinburgh |