Corpse Reviver: Sound and Efficient Gradual Typing via Contract Verification
Cameron Moy, Ph\'uc C. Nguy\~en, Sam Tobin-Hochstadt, David, Van Horn

TL;DR
This paper introduces a static analysis technique for gradually-typed languages that significantly reduces runtime checks, thereby improving performance and maintaining soundness.
Contribution
It presents a modular static analysis approach based on contract verification to eliminate unnecessary runtime checks in gradually-typed programs.
Findings
Median overhead reduced to 1.6x from 3.5x
All runtime checks eliminated in most cases
Up to 73.6x overhead in worst case
Abstract
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.…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
