HackerPapers

arXiv:2007.12630cs.PL

Corpse Reviver: Sound and Efficient Gradual Typing via Contract Verification

Cameron Moy, Phúc C. Nguyen, Sam Tobin-Hochstadt, David Van Horn

Early discovery. Linked by one identifiable commenter. This paper is outside the main ranking; a mention is not an endorsement.

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. 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\times$ and up to $73.6\times$ in the worst case---and eliminate all overhead in most cases, suffering only $1.6\times$ overhead in the worst case.

arXiv comments
To appear in POPL 2021
Journal reference
DOI
Subjects
cs.PLProgramming Languages

On Hacker News

Linked by 1 identifiable commenter in 1 comment across 1 thread, from Nov 2020 to Nov 2020. Found in 1 HN submission from Oct 2020 to Oct 2020. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments1 thread

  1. Multi-Paradigm Languages 1 comment
    • Of course — this paper talks about the mechanism which Racket explores to keep the boundary safe [1]. This paper [2] elaborates on some of the performance challenges. 'Shallow typing' by Ben Greenman et al. is available only by video [3] and slideshow form [4]. Finally, there's…

      ywei3410View on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.