Property-based testing (PBT) relies on generators for random test cases, often constructed using embedded domain specific languages, which provide expressive combinators for building and composing generators. The effectiveness of PBT depends critically on the speed of these generators. However, careful measurements show that the generator performance of widely used PBT libraries falls well short of what is possible, due principally to (1) the abstraction overhead of their combinator-heavy style and (2) suboptimal sources of randomness. We characterize, quantify, and address these bottlenecks. To eliminate abstraction overheads, we propose a technique based on multi-stage programming, dubbed Allegro. We apply this technique to leading generator libraries in OCaml and Scala 3, significantly improving performance. To quantify the performance impact of the randomness source, we carry out a controlled experiment, replacing the randomness in the OCaml PBT library with an optimized version. Both interventions exactly preserve the semantics of generators, enabling precise, pointwise comparisons. Together, these improvements find bugs up to $13\times$ faster.


翻译:属性基测试(PBT)依赖生成器生成随机测试用例,这些生成器通常通过内嵌领域特定语言构建,提供富有表达力的组合子来构建和组合生成器。PBT的有效性关键取决于这些生成器的速度。然而,精确测量表明,广泛使用的PBT库的生成器性能远未达到理论可能,主要原因在于:(1)其组合子密集型风格带来的抽象开销;(2)次优的随机性来源。我们描述、量化并解决了这些瓶颈。为消除抽象开销,我们提出一种基于多阶段编程的技术,称为Allegro。我们将该技术应用于OCaml和Scala 3中领先的生成器库,显著提升了性能。为量化随机性来源对性能的影响,我们进行了一项控制实验,将OCaml PBT库中的随机性替换为优化版本。这两种干预方法均精确保持了生成器的语义,从而能够进行精确的逐点比较。综合这些改进,发现缺陷的速度最高可提升$13\times$倍。

0
下载
关闭预览

相关内容

面向多模态智能的下一个Token预测:综述
专知会员服务
26+阅读 · 2024年12月30日
【Google】高效Transformer综述,Efficient Transformers: A Survey
专知会员服务
66+阅读 · 2022年3月17日
英伟达Faster Transformer:作者带你揭秘BERT优化
机器之心
14+阅读 · 2019年9月18日
换个角度看GAN:另一种损失函数
机器之心
16+阅读 · 2019年1月1日
推荐|上交大推出Texygen:文本生成模型的基准测试平台
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Arxiv
0+阅读 · 2月20日
VIP会员
相关主题
最新内容
驱动军事决策变革的顶尖人工智能指挥系统
专知会员服务
3+阅读 · 今天13:50
非对称防御中的自组织临界性:俄乌战争
专知会员服务
9+阅读 · 8月10日
《战争中的大语言模型监管》
专知会员服务
11+阅读 · 8月10日
《边缘计算关键技术分析及美军作战实践应用》
边缘计算的军事应用
专知会员服务
11+阅读 · 8月9日
一种考虑资源机动性的武器目标分配混合算法
专知会员服务
13+阅读 · 8月8日
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员