Smart Inlining: Splitting the Difference for Functional Program Optimization

The Hong Kong University of Science and Technology
Department of Computer Science and Engineering


MPhil Thesis Defence


Title: "Smart Inlining: Splitting the Difference for Functional Program 
Optimization"

By

Mr. Ruqing YANG


Abstract:

We propose a novel approach to perform smart inlining without requiring any 
prior statistics on program runtime characteristics. This method abandons 
the traditional all-or-nothing inlining principle, allowing for the reliable 
inlining of function parts while maintaining code sharing and reducing 
running time. To achieve this, we use a technique called function splitting, 
which divides functions into reusable and independent components. This 
enables us to operate on each component independently, thus avoiding the 
need to inline the entire function. We implement our approach in hkmc2, a 
compiler for the MLscript language. We evaluate our approach using 
benchmarks from the Lean4, Koka, and Nofib benchmark suites. This evaluation 
shows performance improvement on benchmarks with existing optimizable code 
patterns. However, we also observed performance regression on specific 
benchmarks, indicating room for improvement in our implementation.


Date:                   Monday, 14 July 2025

Time:                   2:00pm - 4:00pm

Venue:                  Room 5501
                        Lifts 25/26

Chairman:               Dr. Shuai WANG

Committee Members:      Dr. Lionel PARREAUX (Supervisor)
                        Prof. Shing-Chi CHEUNG