Parallel JS (River Trail): soon in Firefox

[2013-03-24] dev, javascript
(Ad, please don’t block)
2013-12-23: A new blog post on ParallelJS (as Parallel JS is now called) supersedes this post.

Parallel JS will soon be included in Firefox Nightly builds. This project was initially called River Trail [1]. It automatically parallelizes code that uses the ParallelArray type and its array-like methods (map() etc.). [Source of this post: “Parallel JS lands” by Nicholas D. Matsakis.]

Time table:

  • Now: Only a limited subset of JavaScript is supported and you don’t get good feedback as to whether your code could be parallelized and if not, why not.
  • Medium term: All pure functions (that don’t mutate shared state, only data that they create and store in local variables) will be parallelizable; better diagnostics when parallelization is not possible.
  • Long term: Make parallelization as wide-spread in JavaScript as possible and evolve the API. One possible improvement is to bring parallelization to normal arrays. Currently, ParallelArray pulls double duty, it is both a lightweight array that can be manipulated in parallel and a capable multi-dimensional matrix. Matsakis proposes adding parallelizing methods to arrays (e.g. unorderedMap()), so that ParallelArray can focus on the latter duty.