Skip to main content
QUICK REVIEW

[논문 리뷰] Efficient Gradual Typing

Andre Kuhlenschmidt, Deyaaeldeen Almahallawi|arXiv (Cornell University)|2018. 02. 18.
Parallel Computing and Optimization Techniques참고 문헌 37인용 수 6
한 줄 요약

이 논문은 공간 효율적인 코ercion과 단조성 참조를 사용하여 높은 성능을 달성하는 점진적 타이핑을 위한 사전 컴파일러인 Grift를 제시한다. 정적 타이핑 코드에서 OCaml과 동등한 성능을 달성하고, 부분적 타이핑 벤치마크에서 Racket를 능가하며(0.42×에서 2.36×까지), 뚜렷한 오버헤드 없이 치명적인 성능 저하를 제거함으로써, 철저한 저수준 구현을 통해 효율적인 점진적 타이핑이 가능하다는 것을 입증한다.

ABSTRACT

Gradual typing combines static and dynamic typing in the same program. One would hope that the performance in a gradually typed language would range between that of a dynamically typed language and a statically typed language. Existing implementations of gradually typed languages have not achieved this goal due to overheads associated with runtime casts. Takikawa et al. (2016) report up to 100$ imes$ slowdowns for partially typed programs. In this paper we present a compiler, named Grift, for evaluating implementation techniques for gradual typing. We take a straightforward but surprisingly unexplored implementation approach for gradual typing, that is, ahead-of-time compilation to native assembly code with carefully chosen runtime representations and space-efficient coercions. Our experiments show that this approach achieves performance on par with OCaml on statically typed programs and performance between that of Gambit and Racket on untyped programs. On partially typed code, the geometric mean ranges from 0.42$ imes$ to 2.36$ imes$ that of (untyped) Racket across the benchmarks. We implement casts using the coercions of Siek, Thiemann, and Wadler (2015). This technique eliminates all catastrophic slowdowns without introducing significant overhead. Across the benchmarks, coercions range from 15% slower (fft) to almost 2$ imes$ faster (matmult) than regular casts. We also implement the monotonic references of Siek et al. (2015). Monotonic references eliminate all overhead in statically typed code, and for partially typed code, they are faster than proxied references, sometimes up to 1.48$ imes$.

연구 동기 및 목표

  • 점진적 타이핑 언어에서 동적 타이핑 프로그램과 정적 타이핑 프로그램 간의 성능 격차를 해소하기 위해.
  • 이전의 점진적 타이핑 구현에서 보고된 100배의 성능 저하 문제를 해결하기 위해.
  • 타당성과 상호운용성을 유지하면서도 효율적인 런타임 메커니즘인 코ercion과 단조성 참조를 구현하기 위해.
  • 사전 컴파일을 통해 네이티브 어셈블리 코드로 컴파일함으로써 점진적 타이핑에서 높은 성능을 달성할 수 있음을 입증하기 위해.
  • 정적, 동적, 혼합 타입 프로그램에서 실제 벤치마크를 대상으로 코ercion과 단조성 참조의 영향을 평가하기 위해.

제안 방법

  • 사전 컴파일을 통해 점진적 타이핑 프로그램을 네이티브 어셈블리 코드로 컴파일한다.
  • Siek, Thiemann, 그리고 Wadler(2015)의 공간 효율적인 코ercion을 활용하여 런타임 비용을 최소화하는 타입 캐스트를 구현한다.
  • 정적 타이핑 영역에서의 런타임 오버헤드를 제거하기 위해 단조성 참조를 도입한다.
  • 메모리 및 실행 비용을 감소시키기 위해 신중하게 선택된 런타임 표현 방식을 사용한다.
  • 타입 안전성과 효율성을 동시에 확보할 수 있도록 코ercion과 단조성 참조를 지원하는 의미론을 구현한다.
  • Grift가 OCaml, Gambit, Racket와 비교하여 성능을 평가하는 일련의 벤치마크를 수행한다.

실험 결과

연구 질문

  • RQ1점진적 타이핑을 위한 사전 컴파일러가 OCaml와 같은 정적 타이핑 언어의 성능에 도달할 수 있는가?
  • RQ2공간 효율적인 코ercion은 뚜렷한 오버헤드 없이 부분적 타이핑 프로그램에서 치명적인 성능 저하를 제거할 수 있는가?
  • RQ3단조성 참조는 타당성을 유지하면서 정적 타이핑 영역에서의 런타임 오버헤드를 제거할 수 있는가?
  • RQ4이러한 기법을 사용해 구현된 점진적 타이핑 언어의 성능은 기존의 동적 및 정적 언어 런타임과 비교해 어떻게 되는가?
  • RQ5코ercion과 단조성 참조는 다양한 벤치마크에서 성능 향상에 얼마나 기여하는가?

주요 결과

  • 정적 타이핑 프로그램에서 Grift는 OCaml 수준의 성능을 달성하여 점진적 타이핑으로 인한 측정 가능한 오버헤드가 없음을 시사한다.
  • 동적 타이핑 프로그램에서 Grift의 성능은 Gambit와 Racket 사이에 위치하여 기존의 동적 언어 런타임과 경쟁 가능함을 보여준다.
  • 부분적 타이핑 벤치마크에서 Grift의 기하평균 성능은 Racket의 0.42×에서 2.36× 사이를 오가며 효율성과 내구성을 동시에 입증한다.
  • 코ercion은 기존의 캐스트보다 성능 오버헤드를 줄이며, fft 벤치마크에서는 일반 캐스트보다 15% 느리지만, matmult에서는 최대 2배 빠르게 작용한다.
  • 단조성 참조는 정적 타이핑 영역에서 모든 런타임 오버헤드를 제거하며, 부분적 타이핑 코드에서는 프oxy 참조보다 최대 1.48배 빠르게 작용한다.
  • 코ercion과 단조성 참조의 조합은 이전에 최대 100배로 보고된 치명적인 성능 저하를 제거하면서도 뚜렷한 성능 패널티를 유발하지 않는다.

더 나은 연구,지금 바로 시작하세요

논문 읽기부터 검토까지, 연구 시간을 획기적으로 줄여보세요.

카드 등록 없음 · 무료 플랜 제공

이 리뷰는 AI가 만들고, 인간 에디터가 검토했습니다.