Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 843391 of ParallelArray

  • Revision slug: Web/JavaScript/Reference/Global_Objects/ParallelArray
  • Revision title: ParallelArray
  • Revision id: 843391
  • Created:
  • Creator: fscholz
  • Is current revision? No
  • Comment minor cleaning

Revision Content

{{jsSidebar("Objects")}}{{obsolete_header}}

Note: This object was implemented in Firefox 17 and has been removed from {{ Gecko(29) }} in favor of ParallelJS (PJS) currently available in the Nightly channel ({{ bug(944074) }}).

The goal of ParallelArray was to enable data-parallelism in web applications. The higher-order functions available on ParallelArray attempted 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
reduce
scan
scatter
filter
flatten
partition
get

Examples

Using map in parallel

var p = new ParallelArray([0, 1, 2, 3, 4]);
var m = p.map(function (v) {
  return v + 1;
});

See also

Revision Source

<div>
<div>{{jsSidebar("Objects")}}{{obsolete_header}}</div>
</div>

<div class="note">
<p><strong>Note:</strong> This object was implemented in Firefox 17 and has been removed from {{ Gecko(29) }} in favor of ParallelJS (PJS) currently available in the Nightly channel ({{ bug(944074) }}).</p>
</div>

<p>The goal of <strong><code>ParallelArray</code></strong> was to enable data-parallelism in web applications. The higher-order functions available on <code>ParallelArray</code> attempted 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 <a href="https://smallcultfollowing.com/babysteps/blog/2013/04/30/parallelizable-javascript-subset/" title="/en-US/docs/ParallelizableJavaScriptSubset">parallelizable subset of JS that Firefox supports</a>.</p>

<h2 id="Syntax">Syntax</h2>

<pre class="syntaxbox">
new ParallelArray()
new ParallelArray([element0, element1, ...])
new ParallelArray(arrayLength, elementalFunction)</pre>

<h2 id="ParallelArray_instances"><code>ParallelArray</code> instances</h2>

<h3 id="Properties">Properties</h3>

<dl>
 <dt>length</dt>
 <dd>Reflects the number of elements in the <code>ParallelArray</code>.</dd>
</dl>

<h3 id="Methods">Methods</h3>

<dl>
 <dt>map</dt>
 <dt>reduce</dt>
 <dt>scan</dt>
 <dt>scatter</dt>
 <dt>filter</dt>
 <dt>flatten</dt>
 <dt>partition</dt>
 <dt>get</dt>
</dl>

<h2 id="Examples">Examples</h2>

<h3 id="Example_Using_map_in_parallel">Using <code>map</code> in parallel</h3>

<pre class="brush: js">
var p = new ParallelArray([0, 1, 2, 3, 4]);
var m = p.map(function (v) {
  return v + 1;
});</pre>

<h2 id="See_also">See also</h2>

<ul>
 <li><a href="https://wiki.ecmascript.org/doku.php?id=strawman:data_parallelism" title="https://wiki.ecmascript.org/doku.php?id=strawman:data_parallelism">Ecmascript ParallelArray strawman</a></li>
</ul>
Revert to this revision