Collapsible contracts: fixing a pathology of gradual typing

Collapsible contracts: fixing a pathology of gradual typing
复制标题

可折叠合约:修复渐进式打字的病态

DOI:
10.1145/3276503
复制
发表时间:
2018
影响因子:
--
通讯作者:
St-Amour, Vincent
St-Amour, Vincent
中科院分区:
--
文献类型:
--
作者:
Feltey, Daniel;Greenman, Ben;Scholliers, Christophe;Findler, Robert Bruce;St-Amour, Vincent

文献摘要

参考文献

被引文献

相似文献

渐进类型的承诺是程序员应该获得两个世界的最佳状态:静态类型的静态保证和无类型编程的动态灵活性。这是一个诱人的好处,但在实践中,可能会带来巨大的成本。事实上,这足以威胁到渐进式打字的实用性;据报道,渐进式打字会导致高达120倍的速度下降。如果仔细检查这些结果,很明显,渐进式打字的成本并不是均匀分布的。事实上,虽然混合类型化和非类型化代码几乎总是带来不小的成本,但许多真正破坏交易的缓慢表现出病态的性能。不幸的是,这些病态情况的存在-因此在开发过程中遇到它们的可能性-使得渐进式输入在任何关心性能的设置中都是一个有风险的建议。这项工作攻击了这些病态情况下的一个巨大开销的来源:执行冗余检查的合同包装器的积累。本文提出了一种新的合约检测策略-可折叠合约-它消除了函数合约和向量合约的冗余,大大减少了合约包装器的开销,并将其作为Racket合约系统的一部分实现,该系统用于Typed Racket渐进式类型化系统。我们的实验表明,我们的策略成功地带来了一类病理情况下,正常情况下,而不引入不适当的开销,任何其他情况下。我们的研究结果还表明,在Racket中逐步键入的性能仍然令人望而却步,但可折叠的合同是降低逐步键入成本的一个重要因素。
The promise 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, many truly deal-breaking slowdowns exhibit pathological performance. 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---collapsible contracts---which eliminates this redundancy for function and vector contracts and drastically reduces the overhead of contract wrappers.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 any of the other cases. Our results also show that the performance of gradual typing in Racket remains prohibitive for many programs, but that collapsible contracts are one essential ingredient in reducing the cost of gradual typing.
TypeScript 的具体类型
DOI: 10.4230/lipics.ecoop.2015.76
发表时间: 2015
影响因子: --
作者:
G. Richards;Francesco Zappa Nardelli;J. Vitek
通讯作者: J. Vitek
声音渐进打字已经死了吗?
DOI: --
发表时间: 2016
期刊: ACM-SIGACT Symposium on Principles of Programming Languages
影响因子: --
作者:
Asumu Takikawa;Daniel Feltey;B. Greenman;Max S. New;J. Vitek;M. Felleisen
通讯作者: M. Felleisen
节省空间的渐进打字
DOI: 10.1007/s10990-011-9066-z
发表时间: 2010
期刊: Higher-Order and Symbolic Computation
影响因子: --
作者:
David Herman;Aaron Tomb;C. Flanagan
通讯作者: C. Flanagan
Strongtalk:在生产环境中对 Smalltalk 进行类型检查
DOI: 10.1145/165854.165893
发表时间: 1993
期刊: ACM Trans. Program. Lang. Syst.
影响因子: --
作者:
Gilad Bracha;David Griswold
通讯作者: David Griswold
混合消息:衡量 TypeScript 中的一致性和不干扰性
DOI: --
发表时间: 2017
期刊: European Conference on Object-Oriented Programming
影响因子: --
作者:
Jack Williams;J. Garrett Morris;P. Wadler;Jakub Zalewski
通讯作者: Jakub Zalewski