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

  • Revision slug: Web/JavaScript/Reference/Global_Objects/ParallelArray
  • Revision title: ParallelArray
  • Revision id: 492921
  • Created:
  • Creator: kscarfone
  • Is current revision? No
  • Comment Replaced Gecko_callout_header macro with a simple note

Revision Content

{{ gecko_minversion_header("17.0") }}

{{ Non-standard_header() }}

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

See also

Revision Source

<p>{{ gecko_minversion_header("17.0") }}</p>
<p>{{ Non-standard_header() }}</p>
<div class="note">
 <p><strong>Note:</strong> As of {{Gecko ("22.0")}}, this object is now disabled in the Beta, Release and ESR channels. Use the <a class="external" href="https://www.mozilla.org/en-US/firefox/aurora/">Aurora</a> or <a class="external" href="https://nightly.mozilla.org/">Nightly</a> channel to try out this feature. ({{ bug(853067) }})</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="/en-US/docs/ParallelizableJavaScriptSubset" 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