Common Java Streams Mistakes (part 2): Using Collections that Don't Split Evenly and/or Efficiently

preview_player
Показать описание
This video shows the difference in overhead for using a parallel spliterator to split a Java LinkedList versus an ArrayList into chunks. It also shows the difference in overhead between combining and collecting results in a parallel stream vs. sequential stream using concurrent and non-concurrent collectors.
Рекомендации по теме
Комментарии
Автор

What I noticed is, parallel streams are more effective for I/O operations , if its in-memory operations then streams are more effective.

jagapathiraju
Автор

I thought collecting to a HashSet in parallel was a bad idea, but it seems it still performs better than collecting sequential (for 100, 000+ words), is that expected? Further to this, what would be the big O time complexity for collecting from a parallel stream to a HashSet non-concurrently?

timwalters