The Power and Perils of Parallel Streams
summary
Explains when parallel streams actually help (many elements and heavy per-item work) and when they hurt (too few items, too many threads), shows that the default uses the ForkJoinPool.commonPool sized to CPU cores (main thread participates so effective threads = cores − 1), demonstrates configuring threads with -Djava.util.concurrent.ForkJoinPool.common.parallelism or a custom ForkJoinPool, warns that pipeline is entirely parallel or sequential, that ordering is a terminal constraint (findAny vs findFirst), and that reduce needs an identity value not initial value or results are wrong.
AI-written summary · about
chapters (5)
- 0:00Start
- 1:28Parallel Arrays
- 9:58How Do You Know if a Stream Has Ordering or Not
- 14:49Add Method
- 26:25Blocking Factor
related talks
02h 35mParallel and Asynchronous Programming with Streams and CompletableFuture
01h 01mFrom Concurrent to Parallel
50mFrom Concurrent to Parallel
47mStreams – Below the Surface
44mThinking in Streams
01h 00mLet’s Get to the Rapids: Java 8 Stream Performance
46mThinking in Streams
54mParallel-Ready Java Code: Managing Mutation in an Imperative Language
