Context: Container data types are ubiquitous in computer programming, enabling developers to efficiently store and process collections of data with an easy-to-use programming interface. Many programming languages offer a variety of container implementations in their standard libraries based on data structures offering different capabilities and performance characteristics. Inquiry: Choosing the *best* container for an application is not always straightforward, as performance characteristics can change drastically in different scenarios, and as real-world performance is not always correlated to theoretical complexity. Approach: We present Primrose, a language-agnostic tool for selecting the best performing valid container implementation from a set of container data types that satisfy *properties* given by application developers. Primrose automatically selects the set of valid container implementations for which the *library specifications*, written by the developers of container libraries, satisfies the specified properties. Finally, Primrose ranks the valid library implementations based on their runtime performance. Knowledge: With Primrose, application developers can specify the expected behaviour of a container as a type refinement with *semantic properties*, e.g., if the container should only contain unique values (such as a `set`) or should satisfy the LIFO property of a `stack`. Semantic properties nicely complement *syntactic properties* (i.e., traits, interfaces, or type classes), together allowing developers to specify a container's programming interface *and* behaviour without committing to a concrete implementation. Grounding: We present our prototype implementation of Primrose that preprocesses annotated Rust code, selects valid container implementations and ranks them on their performance. The design of Primrose is, however, language-agnostic, and is easy to integrate into other programming languages that support container data types and traits, interfaces, or type classes. Our implementation encodes properties and library specifications into verification conditions in Rosette, an interface for SMT solvers, which determines the set of valid container implementations. We evaluate Primrose by specifying several container implementations, and measuring the time taken to select valid implementations for various combinations of properties with the solver. We automatically validate that container implementations conform to their library specifications via property-based testing. Importance: This work provides a novel approach to bring abstract modelling and specification of container types directly into the programmer's workflow. Instead of selecting concrete container implementations, application programmers can now work on the level of specification, merely stating the behaviours they require from their container types, and the best implementation can be selected automatically.


翻译:背景:容器数据类型在计算机编程中无处不在,使开发者能够通过易用的编程接口高效存储和处理数据集合。许多编程语言在其标准库中提供了多种基于不同数据结构的容器实现,这些实现具有不同的能力和性能特征。问题:为应用程序选择"最佳"容器并非易事,因为性能特征在不同场景下可能发生剧烈变化,且实际性能与理论复杂度并不总是相关。方法:我们提出Primrose,一种与语言无关的工具,能从满足应用程序开发者给定"属性"的容器数据类型集合中,选择性能最佳的合法容器实现。Primrose自动筛选出符合"库规范"的合法容器实现集合,这些库规范由容器库开发者编写,且满足指定的属性。最后,Primrose根据运行时性能对合法库实现进行排序。知识:通过Primrose,应用程序开发者可以将容器的预期行为指定为带有"语义属性"的类型精化,例如容器应仅包含唯一值(如`set`)或应满足`stack`的LIFO属性。语义属性与"句法属性"(即trait、接口或类型类)形成良好互补,共同使开发者能够指定容器的编程接口"和"行为,而无需绑定到具体实现。依据:我们展示了Primrose的原型实现,该实现预处理带注解的Rust代码,选择合法容器实现并根据性能排序。然而,Primrose的设计与语言无关,易于集成到其他支持容器数据类型及trait、接口或类型类的编程语言中。我们的实现将属性和库规范编码为Rosette(SMT求解器的接口)中的验证条件,由后者确定合法容器实现集合。我们通过指定多个容器实现,并测量求解器为各种属性组合选择合法实现所花费的时间来评估Primrose。我们通过基于属性的测试自动验证容器实现是否符合其库规范。重要性:这项工作提供了一种新颖的方法,将容器类型的抽象建模与规范直接融入程序员的工作流程。应用程序开发者不再需要选择具体的容器实现,而是可以在规范层面工作,仅需声明其对容器类型所需的行为,最佳实现即可自动选择。

0
下载
关闭预览

相关内容

100+篇《自监督学习(Self-Supervised Learning)》论文最新合集
专知会员服务
167+阅读 · 2020年3月18日
机器学习入门的经验与建议
专知会员服务
94+阅读 · 2019年10月10日
【哈佛大学商学院课程Fall 2019】机器学习可解释性
专知会员服务
105+阅读 · 2019年10月9日
【SIGGRAPH2019】TensorFlow 2.0深度学习计算机图形学应用
专知会员服务
41+阅读 · 2019年10月9日
最新BERT相关论文清单,BERT-related Papers
专知会员服务
53+阅读 · 2019年9月29日
VCIP 2022 Call for Demos
CCF多媒体专委会
1+阅读 · 2022年6月6日
Hierarchically Structured Meta-learning
CreateAMind
27+阅读 · 2019年5月22日
Transferring Knowledge across Learning Processes
CreateAMind
29+阅读 · 2019年5月18日
逆强化学习-学习人先验的动机
CreateAMind
16+阅读 · 2019年1月18日
Unsupervised Learning via Meta-Learning
CreateAMind
44+阅读 · 2019年1月3日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
18+阅读 · 2018年12月24日
disentangled-representation-papers
CreateAMind
26+阅读 · 2018年9月12日
【SIGIR2018】五篇对抗训练文章
专知
12+阅读 · 2018年7月9日
【推荐】用Tensorflow理解LSTM
机器学习研究会
36+阅读 · 2017年9月11日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2011年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
Arxiv
0+阅读 · 2023年4月11日
Arxiv
30+阅读 · 2021年8月18日
VIP会员
最新内容
《多域战场上反制小型无人机系统》150页
专知会员服务
2+阅读 · 26分钟前
战场人工智能:增强陆地作战能力的发现与要求
专知会员服务
0+阅读 · 36分钟前
以人工智能为中心的指挥控制
专知会员服务
0+阅读 · 59分钟前
《基于深度强化学习的反无人机技术研究》178页
专知会员服务
10+阅读 · 6月10日
“史诗怒火”行动与“AI中心战”模式的浮现
专知会员服务
9+阅读 · 6月10日
【CVPR2026教程】扩散模型的解析理解
专知会员服务
3+阅读 · 6月10日
马赛克战:俄乌战场透析
专知会员服务
16+阅读 · 6月10日
相关资讯
VCIP 2022 Call for Demos
CCF多媒体专委会
1+阅读 · 2022年6月6日
Hierarchically Structured Meta-learning
CreateAMind
27+阅读 · 2019年5月22日
Transferring Knowledge across Learning Processes
CreateAMind
29+阅读 · 2019年5月18日
逆强化学习-学习人先验的动机
CreateAMind
16+阅读 · 2019年1月18日
Unsupervised Learning via Meta-Learning
CreateAMind
44+阅读 · 2019年1月3日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
18+阅读 · 2018年12月24日
disentangled-representation-papers
CreateAMind
26+阅读 · 2018年9月12日
【SIGIR2018】五篇对抗训练文章
专知
12+阅读 · 2018年7月9日
【推荐】用Tensorflow理解LSTM
机器学习研究会
36+阅读 · 2017年9月11日
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2011年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
Top
微信扫码咨询专知VIP会员