This article is in need of a technical review.
Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
Note: As of Gecko 22.0, this object is now disabled in the Beta, Release and ESR channels. Use the Aurora or Nightly channel to try out this feature. (bug 853067)
Summary
The goal of ParallelArray is to enable data-parallelism in web applications. The higher-order functions available on ParallelArray attempt to execute in parallel, though they may fall back to sequential execution if necessary. To ensure that your code executes in parallel, it is suggested that the functions should be limited to the parallelizable subset of JS that Firefox supports.
Syntax
new ParallelArray() new ParallelArray([element0, element1, ...]) new ParallelArray(arrayLength, elementalFunction)
ParallelArray
instances
Properties
- length
-
Reflects the number of elements in the
ParallelArray
.
Methods
- map
- Apply map callback to array elements.
- reduce
- scan
- scatter
- Scatter array elements.
- filter
- flatten
- partition
- get
- Get ParallelArray element.
Examples
Example: Using map in parallel
var p = new ParallelArray([0, 1, 2, 3, 4]); var m = p.map(function (v) { return v + 1; });