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 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.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

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

  • Adi Harif,
  • Shachar Itzhaky

摘要

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 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.