Let’s Get to the Rapids: Java 8 Stream Performance
summary
Argues that sequential Java 8 streams usually match or beat hand-written loops but parallel streams only help when the data source is efficiently splitable and per-element work is large enough to offset setup overhead. Reproduces grep -b with a custom LineSpliterator over a mapped byte buffer, shows combiner-heavy collectors and streaming IO defeat parallelism, and reports a practical 2.5× speedup on 4 hardware threads when those conditions hold. Recommends profiling order, watching GC/IO, and using Google Caliper / the Java benchmarking harness; notes fork-join setup cost ~100 µs.
AI-written summary · about
chapters (6)
- 0:00Introduction and speaker background
- 10:03Microbenchmarking challenges
- 27:33Case study: Grep-B implementation
- 38:12Parallel streams and splitters
- 49:00When to use parallel streams
- 53:37Q&A session
related talks
57mMaximizing the Performance of Java 8 Streams
50mFrom Concurrent to Parallel
47mWhen Greed Is Good: Understanding Java Stream Performance
51mIf Streams Are So Great, Let’s Use Them Everywhere... Right??
47mStreams – Below the Surface
10mJava streams performance and optimization
46mMake Your CPU Cores Sweat with Parallel Streams
44mThinking in Streams
