npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

parallel-es

v0.1.18

Published

Simple parallelization for EcmaScript

Downloads

10

Readme

parallel.es

Build Status Coverage Status npm version

A JavaScript library to perform parallel JavaScript computations with ease (and other environments soon).

Getting Started

Install Parallel.es using npm:

npm install --save parallel-es

or yarn:

yarn add parallel-es

Performing a single computation in a background thread is as simple as calling a normal method:

import parallel from "parallel-es";

parallel.run(function () {
	//… compute
	return [1, 2, 3];
}).then(result => console.log(result));

Or use the reactive API to parallelize data stream based operations. The reactive API automatically splits the input array into sub-arrays, computes the sub-results in a web worker, and joins the resulting arrays:

parallel.range(0, 100000)
	.map(value => value * value)
	.then(result => console.log(result));

To show a progress update, use the subscribe method to register a callback that is invoked whenever a sub-result has been computed:

parallel.range(0, 100000)
	.map(value => value * value)
	.subscribe((subresult, taskIndex) => console.log(`The result of the task ${taskIndex} is`, subresult);)
	.then(result => console.log(result));

For more detail, take a look at the API Documentation.

Debugging Support

Parallel.es uses function serialization and, therefore, debugging is not supported out of the box (except if the debugger statement is used. However, there is a webpack plugin that transpiles the program code and generates the needed source maps to enable debugging (at least in Chrome and Firefox Nightly).

Referenced Functions, Variables, and Imports

Parallel.es uses function serialization and, therefore, the variables from the closure (outer scope) are no longer available when the function is invoked in the background thread. However, there is a webpack plugin that rewrites your code and allows you to use constant variables, and as well, functions defined in the outer scope of the task function. The plugin also exposes any used imports in the background thread.

Documentation

The API Documentation is available online. The wiki describes the architecture in more detail. An academical description of the work is available here.

Examples

An example project using parallel-es and comparing its performance to related projects is parallel-es-example. The examples are hosted here.

Browsers support made by @godban

| IE / Edge | Firefox | Chrome | Safari | Opera | iOS Safari | Android | | --------- | --------- | --------- | --------- | --------- | --------- | --------- | | IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions| last 2 versions| iOS 5.1, iOS 6, iOS 7, iOS 8, iOS 9| Chrome, Android 4.4

Automated browser testing is performed using BrowserStack's open source offer.

BrowserStack

Related Work

There exist other runtime systems with identical or similar goals. The report of the project thesis compares these runtime systems concerning applicability and runtime performance.