The Java 8 Stream API sets forth a promising new programming model that incorporates functional-like, MapReduce-style features into a mainstream programming language. However, using streams efficiently may involve subtle considerations. For example, although streams enable developers to run their code in parallel with little alteration, it is often not obvious if such code runs more efficiently this way. In fact, under certain conditions, running stream code in parallel can be less efficient than running it sequentially. Moreover, it can be unclear if running sequential stream code in parallel is safe and interference-free due to possible lambda expression side-effects.
This project involves an automated refactoring approach that assists developers in writing optimal stream client code in a semantics-preserving fashion. The approach, based on a novel data ordering and typestate analysis, consists of refactorings that include preconditions and transformations for automatically determining when it is safe and possibly advantageous to convert a sequential stream to parallel and improve upon already parallel streams. The approach is implemented as a plug-in to the popular Eclipse IDE utilizing both WALA and SAFE.
|Raffi Khatchadourian||City University of New York (CUNY) Hunter College|
|Yiming Tang||City University of New York (CUNY) Graduate Center|
|Mehdi Bagherzadeh||Oakland University|
|Syed Ahmed||Oakland University|
My and my research students‘ names appear in boldface. Undergraduate students appear in italics.
Raffi Khatchadourian, Yiming Tang, and Mehdi Bagherzadeh. Safe automated refactoring for intelligent parallelization of Java 8 streams. Science of Computer Programming, 195:102476, 2020. [ bib | DOI | http ]
Raffi Khatchadourian, Yiming Tang, Mehdi Bagherzadeh, and Syed Ahmed. Safe automated refactoring for intelligent parallelization of Java 8 streams. Technical Report 544, City University of New York (CUNY) Hunter College, 695 Park Ave, New York, NY 10065 United States, July 2019. [ bib | http ]
Raffi Khatchadourian, Yiming Tang, Mehdi Bagherzadeh, and Syed Ahmed. Safe automated refactoring for intelligent parallelization of Java 8 streams. In International Conference on Software Engineering, ICSE ’19, pages 619–630, Piscataway, NJ, USA, May 2019. ACM/IEEE, IEEE Press. (109/529; 20.6% acceptance rate). [ bib | DOI | tool | slides | http ]
Raffi Khatchadourian, Yiming Tang, Mehdi Bagherzadeh, and Syed Ahmed. A tool for optimizing Java 8 stream software via automated refactoring. In International Working Conference on Source Code Analysis and Manipulation, SCAM ’18. IEEE, September 2018. (9/17; 53% acceptance rate). Best paper award. [ bib | tool | slides | http ]
Yiming Tang, Raffi Khatchadourian, Mehdi Bagherzadeh, and Syed Ahmed. Towards safe refactoring for intelligent parallelization of Java 8 streams. In International Conference on Software Engineering: Companion Proceeedings, ICSE ’18, pages 206–207, New York, NY, USA, May 2018. ACM/IEEE, ACM. [ bib | DOI | poster | http ]
Our research prototype may be found on GitHub.
- edu.cuny.hunter.streamrefactoring.annotations: Annotation library to manually specify program entry points.
|htm.java||0.6.13||Hierarchical Temporal Memory implementation in Java – an official Community-Driven Java port of the Numenta Platform for Intelligent Computing (NuPIC).|
|JacpFX||2.1||An API to create Rich Clients in MVC style with JavaFX, Spring (or other DI frameworks) and an Actor like component approach.|
|java-design-patterns||1.12.0 (bc94d0f)||Design patterns implemented in Java.|
|jdk8-experiments||3c7d717||An personal repository for experimentation with the new JDK 8 features.|
|jetty.project||9.4.8||Eclipse Jetty – Web Container & Clients – supports HTTP/2, HTTP/1.1, HTTP/1.0, websocket, servlets, and more.|
|jOOQ||3.10.4||jOOQ is the best way to write SQL in Java.|
|koral||Scientific publishing with HTML.|
|monads||0.5||Basic monads for Java.|
|retrolambda||2.5.3||Backport of Java 8’s lambda expressions to Java 7, 6 and 5.|
|streamql||0.5.8||A query tool for
|ThreeTen Extra||1.3.2||Provide additional date-time classes that complement those in JDK 8.|
Subject Source Code
The set of open-source Java projects packaged as Eclipse projects used for assessing our refactoring can be downloaded as an archive. Please refer to the included
README.md file for building instructions and the
LICENSE.md file for licensing information.
The data set consisting of the raw results produced during our study can be found on Zenodo.
Scripts used to produce the results can be found in our prototype implementation repository.
jmh_profile.sh are the scripts used to execute the performance evaluation of
java-design-patterns, respectively. They assume that separate git branches are used to store the original source code and the refactored source code; these can be created using the above-mentioned patch files and git.
mvn_check.sh, which also assumes the same git structure, is used to verify that the same test results exist before and after the refactoring. It can be easily adapted for projects that use Gradle.