Degree
Doctor of Philosophy (PhD)
Department
Computer Science
Document Type
Dissertation
Abstract
Gradual typing reconciles the complementary strengths of static and dynamic typing by allowing programmers to incrementally introduce type annotations while preserving the flexibility of dynamically typed code. This approach improves reliability, documentation, and tooling support without sacrificing rapid prototyping. To ensure soundness, gradual type systems enforce annotations through runtime checks, typically implemented via cast insertion. Although these checks guarantee correctness, they can introduce substantial and highly variable runtime overhead, making performance prediction and optimization a central challenge for practical adoption. Prior work has largely focused on coarse-grained (macro-level) configurations, where entire modules are either fully typed or untyped. While such studies reveal severe slowdowns and highlight the cost of soundness, they overlook modern gradual type systems that support fine-grained (micro-level) typing. In these systems, types can be assigned at the level of individual parameters, return values, and even components of composite types. This flexibility creates an exponential configuration space with numerous intermediate configurations that combine static and dynamic types within a single program. Despite their prevalence in real-world migration, the performance behavior of these configurations remains poorly understood. This dissertation presents a comprehensive, data-driven study of gradual typing performance that integrates macro-level insights with detailed micro-level analysis. We systematically evaluate over one million configurations derived from widely used Python benchmarks using a sound gradual typing implementation. Our results show that intermediate configurations exhibit distinct and often extreme performance behaviors not captured by traditional outlying configurations. Small, localized changes to a single parameter’s type can lead to dramatic performance shifts, sometimes exceeding an order of magnitude. Furthermore, increasing type precision does not consistently improve performance; in many cases, it introduces costly runtime casts that degrade execution speed. Building on these findings, we investigate whether gradual typing performance can be learned and predicted. Using features derived from type annotations and cast behavior, we train lightweight machine learning models that accurately predict the execution time of unseen configurations. These models enable efficient exploration of the configuration space and identification of high-performance configurations without exhaustive measurement. Overall, this dissertation demonstrates the critical role of intermediate configurations, challenges the assumption that more precise types yield better performance, and establishes learning-based prediction as an effective tool for performance-aware type migration.
Date
2-6-2026
Recommended Citation
Khan, Mohammad Wahiduzzaman, "Learning and Predicting the Performance of Gradual Type System" (2026). Doctoral Dissertations. 55.
https://scholarshub.louisiana.edu/dissertations/55
DOI
https://proquest.com/docview/3347936946
First Committee Chair
Sheng Chen
First Committee Member
Anthony S. Maida
Second Committee Member
Arun Lakhotia
Third Committee Member
Chee-Hung Henry Chu