Compile-Time Java Stream Fusion via mapMulti
summary
An open-source bytecode-to-bytecode optimizer fuses adjacent map/filter calls into a single mapMulti invocation by translating class files to XML then to Phi-calculus expressions, applying 44 rewriting rules, and lowering back to bytecode (four opcodes → two). On nine benchmarks it wins in 2 cases, matches or preserves performance in most others, reproduces Streamliner’s gains on megamorphic pipelines, adds about +40% compile time, and validates correctness by running 31,799 Kafka unit tests without failures.
AI-written summary · about
chapters (10)
- 0:00Java stream optimization
- 1:48Stream API performance issues
- 4:43Megamorphic benchmarks gap
- 5:27Introducing mapMulti for fusion
- 7:15Bytecode optimization pipeline
- 9:22Rewriting rules in Phi Calculus
- 11:48Stream fusion results
- 13:51Apache Kafka safety testing
- 14:57Compile-time performance impact
- 15:19Key takeaways
related talks
13mEliminating Abstraction Overhead of Java Stream Pipelines using Ahead-of-Time Program Optimization
51mIf Streams Are So Great, Let’s Use Them Everywhere... Right??
10mJava streams performance and optimization
47mWhen Greed Is Good: Understanding Java Stream Performance
56mJava Functional Programming Idioms
44mI didn't know you could do that with Java Streams!
52mTreasure.map(): Functional Programming in JVM-based languages
49mJava Functional Programming Idioms
