Reify Your Collection Queries for Modularity and Speed!

kaestner@cs.cmu.edu (P. Giarrusso, K. Ostermann, M. Eichberg, R. Mitschke, T. Rendel, C. Kästner)
Sat, 05 Mar 2016 18:41:39 -0500

Paolo G. Giarrusso, Klaus Ostermann, Michael Eichberg, Ralf Mitschke, Tillmann Rendel, and Christian Kästner. Reify Your Collection Queries for Modularity and Speed! In Proceedings of the 12th ACM International Conference on Aspect-Oriented Software Development (AOSD), pages 1--12, New York, NY: ACM Press, March 2013.

The collections API of a programming language forms an embedded domain-specific language to express queries and operations on collections. Unfortunately, the ordinary style of implementing such APIs does not allow automatic domain-specific analyses and optimizations such as fusion of collection traversals, usage of indexing, or reordering of filters. Performance-critical code using collections must instead be hand-optimized, leading to non-modular, brittle, and redundant code. We propose SQuOpt, the Scala Query Optimizer—a deep embedding of the Scala collections API that allows such analyses and optimizations to be defined and executed within Scala, with- out relying on external tools or compiler extensions. SQuOpt provides the same “look and feel” (syntax and static typing guar- antees) as the standard collections API. We evaluate SQuOpt by re-implementing several code analyses of the Findbugs tool using SQuOpt and demonstrate that SQuOpt can reconcile modularity and efficiency in real-world applications.