Abstract
List comprehensions provide a powerful abstraction mechanism for expressing computations over ordered collections of data declaratively without having to use explicit iteration constructs. This paper puts forth effectful comprehensions as an elegant way to describe list comprehensions that incorporate loop-carried state. This is motivated by operations such as compression/decompression and serialization/deserialization that are common in log/data processing pipelines and require loop-carried state when processing an input stream of data. We build on the underlying theory of symbolic transducers to fuse pipelines of effectful comprehensions into a single representation, from which efficient code can be generated. Using background theory reasoning with an SMT solver, our fusion and subsequent reachability based branch elimination algorithms can significantly reduce the complexity of the fused pipelines. Our implementation shows significant speedups over reasonable hand-written code (3.4×, on average) and traditionally fused version of the pipeline (2.6×, on average) for a variety of examples, including scenarios for extracting fields with regular expressions, processing XML with XPath, and running queries over encoded data.
Original language | English |
---|---|
Title of host publication | PLDI 2017 - Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation |
Publisher | ACM |
Pages | 17-32 |
Number of pages | 16 |
ISBN (Electronic) | 9781450349888 |
DOIs | |
Publication status | Published - 2017 |
MoE publication type | A4 Article in a conference publication |
Event | ACM SIGPLAN Conference on Programming Language Design and Implementation - Barcelona, Spain Duration: 18 Jun 2017 → 23 Jun 2017 Conference number: 38 |
Conference
Conference | ACM SIGPLAN Conference on Programming Language Design and Implementation |
---|---|
Abbreviated title | PLDI |
Country/Territory | Spain |
City | Barcelona |
Period | 18/06/2017 → 23/06/2017 |
Keywords
- transducers
- comprehensions
- fusion
- deforestation
- reachability analysis
- monads