Skip to content

Include parallel collections in Toolkit? #31

Open
@SethTisue

Description

@SethTisue

I was a bit surprised recently to realize that we didn't include scala-parallel-collections in the Toolkit.

Just now I looked at the old spreadsheet of candidate libraries, assuming I'd see it was considered and rejected or postponed, but I don't even see a spreadsheet entry for it? Was it really never considered?

I think we should include it, or at least discuss including it. It has a lot of things going for it:

  • It's in the scala. namespace
  • It's applicable in many/all problem domains
  • It doesn't really have any direct competition. (Only heavyweight competition, such as parallel streaming in fs2.)
  • It's mature, good quality (few known bugs), and has needed little maintenance
  • It's cross-published for Scala 2.13 and 3
  • Although it's community-maintained, the Scala org has a strong interest in keeping it alive, as it's mentioned in Scala books and such. It's already a Scala "module" which is the next thing down from being in the standard library
  • We have a strong team of volunteers at @scala/collections who are interested in helping with collections stuff

What about the library's usefulness/importance?

For some tasks, it's extremely convenient and can give a large speed benefit. I think it didn't end up being quite as widely used as we'd originally envisioned, but when the unit of work that you need to happen in parallel is large enough, it's super easy to use parallel collections to get a big speedup.

Here's an example. I have a Scala-CLI script that does several hundred independent GitHub API queries. With only this small diff:

+//> using dep org.scala-lang.modules::scala-parallel-collections:1.0.4
...
+import scala.collection.parallel.CollectionConverters.* // for .par
...
-for file <- files
+for file <- files.par

I sped up the script from taking 5 minutes to taking less than 30 seconds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions