Eliminating abstraction overhead of Java stream pipelines using ahead-of-time program optimization
Authors:
Open Access
- 13 November 2020
- journal article
- research article
- Published by Association for Computing Machinery (ACM) in Proceedings of the ACM on Programming Languages
- Vol. 4 (OOPSLA) , 1-29
Abstract
Java 8 introduced streams that allow developers to work with collections of data using functional-style operations. Streams are often used in pipelines of operations for processing the data elements, which leads to concise and elegant program code. However, the declarative data processing style comes at a cost. Compared to processing the data with traditional imperative language mechanisms, constructing stream pipelines requires extra heap objects and virtual method calls, which often results in significant run-time overheads. In this work we investigate how to mitigate these overheads to enable processing data in the declarative style without sacrificing performance. We argue that ahead-of-time bytecode-to-bytecode transformation is a suitable approach to optimization of stream pipelines, and we present a static analysis that is designed to guide such transformations. Experimental results show a significant performance gain, and that the technique works for realistic stream pipelines. For 10 of 11 micro-benchmarks, the optimizer is able to produce bytecode that is as effective as hand-written imperative-style code. Additionally, 77% of 6879 stream pipelines found in real-world Java programs are optimized successfully.Keywords
Funding Information
- European Research Council (647544)
This publication has 34 references indexed in Scilit:
- Fold-based fusion as a library: a generative programming pearl2015
- Automatic program specialization for JavaACM Transactions on Programming Languages and Systems, 2003
- A brief history of just-in-timeACM Computing Surveys, 2003
- Scaling Java Points-to Analysis Using Spark2003
- Optimization of Object-Oriented Programs Using Static Class Hierarchy Analysis2000
- The Cartesian Product Algorithm2000
- Inlining of Virtual MethodsLecture Notes in Computer Science, 1999
- Automatic transformation of series expressions into loopsACM Transactions on Programming Languages and Systems, 1991
- Deforestation: transforming programs to eliminate treesTheoretical Computer Science, 1990
- Monotone data flow analysis frameworksActa Informatica, 1977