I tried to combine an advantages of Lazy and Parallel Collections like that:
Vector( /* some values....*/ ).par.view
- it gives a huge performance boost.But Scala 2.12 marks the method as deprecated for ParSeqLike. What is wrong with a lazy usage of Parallel Collection? Is where any replacement?
Asked
Active
Viewed 144 times
0

Alexey Tukalo
- 21
- 7
-
Looks like it was feasible in 2.10. Although in 2.11 this ability was removed. https://github.com/scala/scala/commit/51cd47491e979b10b5d86992dd2e3efd08f7e214#diff-975c6a2824a578e038b3c345a3c5f062 It appears like it was a step towards collection simplification. – Bruce Lowe May 29 '17 at 17:13
-
Btw, Vector(...).par.view is now the same, functionally, as Vector(...).view. So avoid using it. I can think of no easy way around this. Seems you have to pick view OR par at the moment. You could manually group() your collection and use par on each chunk to to save memory on intermediary objects, but its a bit hacky. – Bruce Lowe May 29 '17 at 17:19
-
@BruceLowe, worksheet shows different signature for this to cases. – Alexey Tukalo Jun 08 '17 at 08:50
1 Answers
1
What is wrong with a lazy usage of Parallel Collection?
If you look at the definition, it isn't parallel: it's defined as def view = seq.view
(so that Vector( /* some values....*/ ).par.view
should be the same as Vector( /* some values....*/ ).view
). And that's what the documentation tells you: use seq.view
directly so it's clear it isn't parallel. Potentially some descendant of ParSeqLike
could override it, but ParVector
doesn't.

Alexey Romanov
- 167,066
- 35
- 309
- 487