The premise of gradual typing is that programmers should get the best of both worlds: the static guarantees of static types, and the dynamic flexibility of untyped programming. This is an enticing benefit, but one that, in practice, may carry significant costs. Significant enough, in fact, to threaten the very practicality of gradual typing; slowdowns as high as 120x are reported as arising from gradual typing.
If one examines these results closely, though, it becomes clear that the costs of gradual typing are not evenly distributed. Indeed, while mixing typed and untyped code almost invariably carries non-trivial costs, truly deal breaking slowdowns are concentrated among a set of pathological cases. Unfortunately, the very presence of these pathological cases—and therefore the possibility of hitting them during development—makes gradual typing a risky proposition in any setting that even remotely cares about performance.
This work attacks one source of large overheads in these pathological cases: an accumulation of contract wrappers that perform redundant checks. The work introduces a novel strategy for contract checking—\emph{collapsible contracts}—which eliminates this redundancy and drastically reduces the overhead of contract wrappers for this pathological case. In turn, this brings their overhead in line with the common case, and thus makes gradual typing a more predictable development choice.
We implemented this checking strategy as part of the Racket contract system, which is used in the Typed Racket gradual typing system. Our experiments show that our strategy successfully brings a class of pathological cases in line with normal cases, while not introducing an undue overhead to normal cases.
Thu 8 NovDisplayed time zone: Guadalajara, Mexico City, Monterrey change
10:30 - 12:00 | |||
10:30 22mTalk | Horn-ICE Learning for Synthesizing Invariants and Contracts OOPSLA Deepak D'Souza , Ezudheen P , Pranav Garg University of Illinois at Urbana-Champaign, Daniel Neider Max Planck Institute for Software Systems, P. Madhusudan University of Illinois at Urbana-Champaign | ||
10:52 22mTalk | Gradual Liquid Type Inference OOPSLA Niki Vazou IMDEA Software Institute, Éric Tanter University of Chile & Inria Paris, David Van Horn University of Maryland, USA | ||
11:15 22mTalk | Collapsible Contracts: Fixing a Pathology of Gradual Typing OOPSLA Daniel Feltey Northwestern University, USA, Ben Greenman Northeastern University, USA, Christophe Scholliers Universiteit Gent, Belgium, Robert Bruce Findler Northwestern University, USA, Vincent St-Amour Northwestern University | ||
11:37 22mTalk | The Root Cause of Blame: Contracts for Intersection and Union Types OOPSLA Jack Williams University of Edinburgh, UK, J. Garrett Morris University of Kansas, USA, Philip Wadler University of Edinburgh, UK |