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 613027 of ParallelArray

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

Revision Content

{{ fx_minversion_section(17) }}

{{ obsolete_header(29) }}

{{ Non-standard_header() }}

Note: As of {{ Gecko(22) }}, this object is disabled in the Beta, Release and ESR channels ({{ bug(853067) }}). This object has been removed from {{ Gecko(29) }} in favor of ParallelJS (PJS) currently available in the Nightly channel ({{ bug(944074) }}).

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;
});

See also

Revision Source

<p>{{ fx_minversion_section(17) }}</p>
<p>{{ obsolete_header(29) }}</p>
<p>{{ Non-standard_header() }}</p>
<div class="note">
 <p><strong>Note:</strong> As of {{ Gecko(22) }}, this object is disabled in the Beta, Release and ESR channels ({{ bug(853067) }}). This object has been removed from {{ Gecko(29) }} in favor of ParallelJS (PJS) currently available in the Nightly channel ({{ bug(944074) }}).</p>
</div>
<h2 id="Summary">Summary</h2>
<p>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 <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>
 <dd>
  Apply map callback to array elements.</dd>
 <dt>
  reduce</dt>
 <dd>
  &nbsp;</dd>
 <dt>
  scan</dt>
 <dt>
  scatter</dt>
 <dd>
  Scatter array elements.</dd>
 <dt>
  filter</dt>
 <dt>
  flatten</dt>
 <dt>
  partition</dt>
 <dt>
  get</dt>
 <dd>
  Get ParallelArray element.</dd>
</dl>
<h2 id="Examples">Examples</h2>
<h3 id="Example.3A_Using_map_in_parallel">Example: Using map 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