Primrose: Selecting Container Data Types by their PropertiesVol. 7
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 always straightforward, as performance characteristics can change drastically in different scenarios, and as real-world performance is not always correlated to theoretical complexity.
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.
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.
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.
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.
Thu 16 MarDisplayed time zone: Osaka, Sapporo, Tokyo change
14:00 - 15:30 | Research Papers 5Research Papers at Faculty of Engineering Building 2, Room 212 Chair(s): Raphael Mosaner JKU Linz | ||
14:00 30mTalk | Primrose: Selecting Container Data Types by their PropertiesVol. 7 Research Papers Xueying Qin The University of Edinburgh, Liam O'Connor University of Edinburgh, Michel Steuwer University of Edinburgh Link to publication | ||
14:30 30mTalk | Revisiting Language Support for Generic Programming: When Genericity is a Core Design GoalVol. 7 Research Papers Benjamin Chetioui University of Bergen, Norway, Jaakko Järvi University of Turku, Magne Haveraaen University of Bergen, Norway Link to publication | ||
15:00 30mTalk | Profiling and Optimizing Java StreamsVol. 7 Research Papers Eduardo Rosales University of Lugano, Switzerland, Matteo Basso Università della Svizzera italiana, Andrea Rosà USI Lugano, Walter Binder USI Lugano Link to publication |