arrow
Return

DUCTAPE: Optimizing Dynamically Typed Programs Using Ahead-of-Time Compilation and Data-Flow Analysis

delete2026-01-01
delete0
PRE
AI
A
Adi Harif *
S
Shachar Itzhaky
DOI:10.1007/978-3-032-07106-4_12delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
The software landscape is showing consistent, accelerated growth in the volume of code developed using dynamic languages. These languages are characterized by dynamic typing and more lax preemptive checks, which allow rapid application development and shorter development cycles. The vast majority of these languages are interpreted; that is, programs are executed by an interpreter in a managed runtime environment. Such interpreters incur significant performance hits, and, to counter that, modern runtime environments usually employ some sort of optimization. The most common one is Just-in-Time compilation (JIT), which translates source code on-demand into native code that can run much faster. Some notable JIT engines (such as V8 for JavaScript) exhibit impressive speedups. Still, in most realistic scenarios, they cannot surpass the performance of hand-crafted native code written in a low-level language like C. There are inherent reasons for why Ahead-of-Time compilation (AOT) is rarely practiced with dynamic languages. Since variables are dynamically typed, this will require most of the type-checking to be done at runtime still, thus limiting the range of optimization that can be performed ahead of time, consequently limiting the benefit of AOT compilation. We propose an approach that utilizes static analysis for the purpose of sound type inference, which can then be leveraged for code generation requiring a minimal amount of runtime type checks. Unlike previous work in this area, our approach eliminates the need for the JIT at runtime. Indeed, for programs that avoid using inherently dynamic features (such as eval or reflection) we can eliminate the need for a managed runtime altogether. Our preliminary results show that programs compiled ahead-of-time using our approach achieve substantial speedups compared to execution in a purely interpreted environment. These speedups are greater than previous efforts in that area. In some cases, our results even come close to execution times using an interpreter with a JIT compiler. This lets us believe that, with further improvements, this methodology can be utilized to surpass JIT speedups.
Keywords:
Static Analysis
Optimizing Compilation
Dynamic Types
Type Inference
Abstract Interpretation

Journal

S
STATIC ANALYSIS, SAS 2025
IF:
0
Papers:
14
Citations:
0

Organization

T
technion israel institute of technology
Scholars:
1.8K
Papers: 759
Citations: 0