Eliminating abstraction overhead of Java stream pipelines using ahead-of-time program optimization
Anders Møller, Oskar Haarklou Veileborg
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.
Ask about this paper
Ask your agent about it.
Lune has read the top-tier papers around this one, so every answer names the papers it rests on.
Your agent calls
Lunesearch_papers
Free to start. No credit card required.
Terminal
Install the CLIlune papers get b84a9b74-49ac-448a-830c-676315b5a9beCited by top-tier papers4
- Fail Faster: Staging and Fast Randomness for High-Performance PBTCynthia Richey, Joseph W. Cutler, Harrison Goldstein, Benjamin C. PierceOOPSLA 2026 · 1 citation
- JEDI: Java Evaluation of Declarative and Imperative Queries: Benchmarking the Java Stream APIFilippo Schiavio, Walter BinderICSE 2026
- Two Approaches to Fast Bytecode Frontend for Static AnalysisChenxi Li, Haoran Lin, Tian Tan, Yue LiOOPSLA 2025
- Heap Abstraction via Early-Confluent Object Merging for Pointer AnalysisJinpeng Wang, Yufei Liang, Zhongsheng Zhan, Tian Tan et al.OOPSLA 2026
Related papers
- Imperative versus Declarative Collection Processing: An RCT on the Understandability of Traditional Loops versus the Stream API in JavaNils Mehlhorn, Stefan HanenbergICSE 2022 · 4 citations
- Why Do Developers Remove Lambda Expressions in Java?Mingwei Zheng, Jun Yang, Ming Wen, Hengcheng Zhu et al.ASE 2021 · 9 citations
- Does the Stream API Benefit from Special Debugging Facilities? A Controlled Experiment on Loops and Streams with Specific DebuggersJan Reichl, Stefan Hanenberg, Volker GruhnICSE 2023 · 1 citation
- StreamQL: a query language for processing streaming time seriesLingkun Kong, Konstantinos MamourasOOPSLA 2020 · 8 citations
- JOSer: Just-In-Time Object Serialization for Heavy Java Serialization WorkloadsChaokun Yang, Pengbo Nie, Ziyi Lin, Weipeng Wang et al.ASPLOS 2026
