Why does this parallel stream run 15x SLOWER? [duplicate]
问题 This question already has answers here : Java 8's streams: why parallel stream is slower? (4 answers) How do I write a correct micro-benchmark in Java? (11 answers) Why is parallel stream slower? (3 answers) Closed 2 years ago . I was attempting to demonstrate to a Java novice streams and such. He said he had read that streams can be slower than for loops for primitive types. So, I set immediately to prove that wrong! What I got was a shock! The for-loop and the serial stream run roughly the