Efficient Gradual Typing

02/18/2018
by   Andre Kuhlenschmidt, et al.
0

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× 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× to 2.36× 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 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×.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
08/07/2019

Space-Efficient Gradual Typing in Coercion-Passing Style

Herman et al. (2007, 2010) pointed out that the insertion of run-time ch...
research
07/24/2020

Corpse Reviver: Sound and Efficient Gradual Typing via Contract Verification

Gradually-typed programming languages permit the incremental addition of...
research
02/20/2019

Optimizing and Evaluating Transient Gradual Typing

Gradual typing enables programmers to combine static and dynamic typing ...
research
01/08/2020

Deep Static Modeling of invokedynamic

Java 7 introduced programmable dynamic linking in the form of the invoke...
research
05/29/2023

Do Language Models Know When They're Hallucinating References?

Current state-of-the-art language models (LMs) are notorious for generat...
research
10/27/2020

Abstracting Gradual Typing Moving Forward: Precise and Space-Efficient (Technical Report)

Abstracting Gradual Typing (AGT) is a systematic approach to designing g...
research
08/23/2017

More declarative tabling in Prolog using multi-prompt delimited control

Several Prolog implementations include a facility for tabling, an altern...

Please sign up or login with your details

Forgot password? Click here to reset