-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scala 2.13 woes: Parallelism silently lost #101
Comments
reminiscent of scala/bug#11987 (there, ordering is lost when using the supertype; here, parallelism is lost instead) |
This one only affects Scala 2.13, whereas the issue you linked already affects 2.12, though. |
I wouldn’t say “silently” since you get a warning telling you that you should not call However, I agree that this is an issue. Actually, I don’t remember why we decided to have a common super type ( |
@julienrf I've seen this warning but all things considered I'll definitely say that there's a silent and serious change in behaviour 🙂 The warning fails to highlight the consequences, recommends the wrong thing, and applying scalafix would probably make the wrong choice silently. |
We were planning on going 1.0.0 soon, so if that were to happen, now would be the time.
the discussions were here:
several people (including Rex and Seb) advocated no-common-supertype, but Julien, Martin, and Stefan all lined up on the " |
Note that if we decide just to improve the documentation on what we have, the logical place to do it would be https://docs.scala-lang.org/overviews/core/collections-migration-213.html |
To explore the possibility of making the parallel collections no longer extend I had to add overloads in a few places, other than that it was mainly a matter of adding a bunch of calls to I'm left ambivalent about this whole issue. the I don't intend to pursue this further, personally. I would add that the question of whether this could still be changed has to be considered in the context of the overall maintenance status of this repo. The work of splitting this repo off from the main Scala repo was done by the core Scala team (namely by Stefan), but as with some of the previously spun-off modules like scala-xml and scala-parser-combinators, we can't really afford to remain heavily involved with driving this repo forward, beyond the usual light maintenance, version bumps, anointing of new maintainers, and such. So, hypothetically, if one or more volunteer maintainers were to adopt this repo and really take charge of driving it forward (as has happened in other module repos: scala-xml, scala-parser-combinators, and Scala-swing all come to mind), and then if those maintainers really wanted to own this parentage change and push it through in a new major version, with appropriate care taken on documentation and migration, then I wouldn't stand in the way. But this is all hypothetical. |
@SethTisue Thank you. As far as I'm concerned we can close this issue; I see that it's not easy to change, and we're not so invested to parallel collections (we only use these in a few places for quick wins) as to push this through. |
Hello,
the following code compiles in Scala 2.12 and 2.13 but silently looses parallelism in 2.13:
In Scala 2.12
items
is of typeGenIterable[T]
but in2.13
it'sIterableOnce[T]
which does not define.map
. Instead.map
now comes fromIterableOnceExtensionMethods
invokes.iterator.map
on anything that's not a Scala 2.13Iterable[T]
..iterator.map
however is a sequential interface (by design), so.map
becomes sequential no matter whether a parallel collection was constructed.This kind of silent change in behaviour can silently cause some serious performance regressions (luckily we had a person with a lot of foresight at our group who wrote a test for parallel execution of a certain piece of code which caught this regression).
I am not so familiar with Scala collections as to suggest a solution but I'd like to make a few remarks:
.iterator
is sequential by design; this makesIterableOnce
a rather dangerous interface for parallel collections to inherit because it allows to accidentally turn a parallel collection into a sequential one.I guess parallel collections should implement some base trait of Scala 2.13 collections;,if that's not possible I think I'd prefer if it did implement no interface at all, not even
IterableOnce
, and lived entirely in a world on its own; then it's at least not possible to misuse parallel collections.Cheers
The text was updated successfully, but these errors were encountered: