#77 SpliteratorUtils#limit for parallel stream

Slēgta
ranides atvēra 4 gadi atpakaļ · 2 komentāri

Parallel stream limit has undefined behaviour.

Probably "stop condition" won't work at all, because parallel threads wont even notice, that some thread rejected some value. At this moment LimitSpliterator is not prepared for parallel executions at all: it uses default split method which buffers results.

Parallel stream limit has undefined behaviour. Probably "stop condition" won't work at all, because parallel threads wont even notice, that some thread rejected some value. At this moment LimitSpliterator is not prepared for parallel executions at all: it uses default split method which buffers results.
ranides komentēja 3 gadi atpakaļ
Īpašnieks

To be honest, our current, default method "trySplit" uses condition all the time and preserves condition?

To be honest, our current, default method "trySplit" uses condition all the time and preserves condition?
ranides pieminēja šo problēmu revīzijā 3 gadi atpakaļ
ranides komentēja 3 gadi atpakaļ
Īpašnieks

bulshit, not a bug.

It works perfectly for parallel list, and hashset, and even IntStream. I have no idea what should be done to generate wrong results.

Spliterator has well defined contract and default implementation of LimitSpliterator gives perfect semantic although limited paralelization.

Limited paralelization means that "filtering" is done internally in single thread, but all other pipeline steps are still parallel. In fact that's exactly what we want to achieve.

bulshit, not a bug. It works perfectly for parallel list, and hashset, and even IntStream. I have no idea what should be done to generate wrong results. Spliterator has well defined contract and default implementation of LimitSpliterator gives perfect semantic although limited paralelization. Limited paralelization means that "filtering" is done internally in single thread, but all other pipeline steps are still parallel. In fact that's exactly what we want to achieve.
Pierakstieties, lai pievienotos šai sarunai.
Nav atskaites punktu
Nav atbildīgā
1 dalībnieki
Notiek ielāde...
Atcelt
Saglabāt
Vēl nav satura.