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.


翻译:渐进式编程语言允许将静态类型逐渐添加到非类型程序中。 保持声音, 语言在输入和未输入的代码之间的边界处插入运行时间检查。 不幸的是, 绩效研究表明, 这些检查的间接费用可能灾难性地高, 令人质疑音响逐步打字的可行性。 在本文中, 我们显示, 通过在软合同核查的现有工作的基础上, 我们可以减少或消除这一间接费用。 我们的关键洞察力是, 虽然未输入的代码无法被渐进式系统信任, 但是在优化一个逐渐类型的程序时, 不需要只考虑最坏的情况。 相反, 我们静态地分析一个渐进式程序的非类型部分, 以证明渐进式边界所隐含的几乎所有动态检查都不可能失败, 并且可以在编译时间里消除。 我们的分析是模块化的, 并且可以适用于一个程序的任何部分。 我们用这个方法来评估一个已有的渐进式程序, 先前显示有令人无法接受的高级性管理间接费用, 其中位为3.5\ times, 在最坏的情况下, 最多只有73.6\ time$。

0
下载
关闭预览

相关内容

Linux导论,Introduction to Linux,96页ppt
专知会员服务
79+阅读 · 2020年7月26日
【SIGIR2020】学习词项区分性,Learning Term Discrimination
专知会员服务
16+阅读 · 2020年4月28日
专知会员服务
62+阅读 · 2020年3月4日
[综述]深度学习下的场景文本检测与识别
专知会员服务
78+阅读 · 2019年10月10日
Hierarchically Structured Meta-learning
CreateAMind
26+阅读 · 2019年5月22日
已删除
创业邦杂志
5+阅读 · 2019年3月27日
Unsupervised Learning via Meta-Learning
CreateAMind
42+阅读 · 2019年1月3日
Auto-Encoding GAN
CreateAMind
7+阅读 · 2017年8月4日
Arxiv
0+阅读 · 2020年11月23日
Arxiv
0+阅读 · 2020年11月23日
Arxiv
0+阅读 · 2020年11月19日
Advances in Online Audio-Visual Meeting Transcription
Arxiv
4+阅读 · 2019年12月10日
VIP会员
相关资讯
Hierarchically Structured Meta-learning
CreateAMind
26+阅读 · 2019年5月22日
已删除
创业邦杂志
5+阅读 · 2019年3月27日
Unsupervised Learning via Meta-Learning
CreateAMind
42+阅读 · 2019年1月3日
Auto-Encoding GAN
CreateAMind
7+阅读 · 2017年8月4日
Top
微信扫码咨询专知VIP会员