parallel-streams: JMH benchmarks and demos for when parallel streams are slower

N x Q model, source splittability, boxing, ordered operations, common-pool
starvation, and parallel-stream correctness bugs. Captured output in output/.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b6hCTuFrQT8xKmmMrF
This commit is contained in:
Claude
2026-11-17 23:23:21 +05:30
parent f8c9e244a3
commit 4511cc6e6b
22 changed files with 1714 additions and 0 deletions
@@ -0,0 +1,15 @@
1. forEach(list::add), n = 100000, ten runs (-1 = exception):
sizes: 90126 86309 22551 86194 -1 22732 87868 10443 15012 77596
collect(toList()) size: 100000
2. reduce(10, Integer::sum) over 1..100
sequential: 5060
parallel : 5210
3. reduce(0, (a, b) -> a - b) over 1..1000
sequential: -500500
parallel : 0
4. counter[0]++ in forEach, n = 100000
racy : 99997
atomic : 100000