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会员
相关主题
最新内容
《衡量语言模型中的作战规划能力》
专知会员服务
4+阅读 · 10月20日
Maven智能系统:帕兰提尔军事人工智能平台详解
专知会员服务
6+阅读 · 10月20日
《测试自动化框架在敏捷软件开发中的角色》
专知会员服务
4+阅读 · 10月20日
俄罗斯如何拦截乌克兰无人机与巡航导弹
专知会员服务
9+阅读 · 10月15日
《武器-目标分配问题:精确与近似求解算法》
专知会员服务
14+阅读 · 10月15日
综述|谁来改进机器人?迈向物理递归自我改进
专知会员服务
11+阅读 · 10月14日
软件定义无人机蜂群给防空带来全新压力
专知会员服务
10+阅读 · 10月13日
相关基金
国家自然科学基金
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会员