Corpse Reviver: Sound and Efficient Gradual Typing via Contract Verification

07/24/2020
by   Cameron Moy, et al.
0

Gradually-typed programming languages permit the incremental addition of static types to untyped programs. To remain sound, languages insert run-time checks at the boundaries between typed and untyped code. Unfortunately, performance studies have shown that the overhead of these checks can be disastrously high, calling into question the viability of sound gradual typing. In this paper, we show that by building on existing work on soft contract verification, we can reduce or eliminate this overhead. Our key insight is that while untyped code cannot be trusted by a gradual type system, there is no need to consider only the worst case when optimizing a gradually-typed program. Instead, we statically analyze the untyped portions of a gradually-typed program to prove that almost all of the dynamic checks implied by gradual type boundaries cannot fail, and can be eliminated at compile time. Our analysis is modular, and can be applied to any portion of a program. We evaluate this approach on a dozen existing gradually-typed programs previously shown to have prohibitive performance overhead—with a median overhead of 3.5× and up to 73.6× in the worst case—and eliminate all overhead in most cases, suffering only 1.6× overhead in the worst case.

READ FULL TEXT
POST COMMENT

Comments

There are no comments yet.

Authors

page 2

page 19

04/06/2018

An Approach to Static Performance Guarantees for Programs with Run-time Checks

Instrumenting programs for performing run-time checking of properties, s...
11/09/2017

Soft Contract Verification for Higher-Order Stateful Programs

Software contracts allow programmers to state rich program properties us...
02/18/2018

Efficient Gradual Typing

Gradual typing combines static and dynamic typing in the same program. O...
10/27/2019

Cilkmem: Algorithms for Analyzing the Memory High-Water Mark of Fork-Join Parallel Programs

Software engineers designing recursive fork-join programs destined to ru...
02/20/2019

Optimizing and Evaluating Transient Gradual Typing

Gradual typing enables programmers to combine static and dynamic typing ...
11/25/2019

Fast Fibonacci heaps with worst case extensions

We are concentrating on reducing overhead of heaps based on comparisons ...
11/24/2020

Contract Scheduling With Predictions

Contract scheduling is a general technique that allows to design a syste...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.