Eliminating abstraction overhead of Java stream pipelines using ahead-of-time program optimization

Research output: Contribution to journal/Conference contribution in journal/Contribution to newspaperConference articleResearchpeer-review

Documents

  • 3428236

    Final published version, 762 KB, PDF document

DOI

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.

Original languageEnglish
Article number168
JournalProceedings of the ACM on Programming Languages
Volume4
IssueOOPSLA
Number of pages29
DOIs
Publication statusPublished - Nov 2020

Bibliographical note

Publisher Copyright:
© 2020 Owner/Author.

Copyright:
Copyright 2020 Elsevier B.V., All rights reserved.

    Research areas

  • Java 8, program optimization, static program analysis

See relations at Aarhus University Citationformats

ID: 202251665