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. Choosing the best container for an application is not straightforward, as performance characteristics can change drastically in different scenarios, and real-world performance is not always correlated to theoretical complexity. In this paper, we present Primrose, a language-agnostic tool for selecting the best performing valid container implementation from a set of container data types that satisfy the given properties. Semantic properties allow application developers to specify the expected behaviour of a container as a type refinement, 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), allowing developers to specify a container's programming interface and behaviour without committing to a concrete implementation. Primrose automatically select 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. We present our prototype implementation of Primrose that preprocesses annotated Rust code, selecting the best performing container implementation. Primrose is easy to integrate in other programming languages. We encode properties and library specifications into verification conditions in a SMT solver to determine the set of valid container implementations.
翻译:在计算机编程中,集装箱数据类型无处不在,使开发者能够以易于使用的编程界面高效率地存储和处理数据收集,许多编程语言以具有不同能力和性能特点的数据结构为基础,在其标准图书馆中提供各种集装箱实施工具。选择一个应用程序的最佳容器并非直截了当,因为性能特征在不同情景中可能会发生巨大变化,而现实世界的性能并不总是与理论复杂性相关联。在本文件中,我们介绍了Primrose,一种语言-不可知性工具,用于从符合特定特性的一套集装箱数据类型中选择最能执行的集装箱有效规格。语义特性使得应用程序开发者能够指定集装箱的预期行为,作为类型改进,例如,如果容器只包含独特的价值(如一套)或满足一个堆的 LIFO 属性,则并非直截然。 语义性能性能特性与理论性能特性(即特性、界面、界面类)相近的集装箱编程界面和行为,而不必承诺具体实施。我们通过程序自动选择一套有效的集装箱性质定序的规格,我们目前运行的版本的版本的版本执行程序。