Execute your javascript in parallel

Leveraging the power of multithreading has never been easier.

Hamsters.js | Parallel Javascript

Facing performance limitations in your javascript applications? Start taking advantage of Hamsters.js in your project today!

  • Open Source
  • Node.js Support
  • React Native Support
mb

Features

Function level multithreading

Maximize performance by spreading work across many threads at once.

Automatic data aggregation

Automatically break a problem into smaller pieces & execute them in parallel with a single output

Automagical sorting

Automatically sort your output alphabetically or numerically

Legacy support

Don't stress about client support, we've taken care of that for you

Open Source

100% open source code base, published under the Artistic License 2.0

Memoization

Compute once, don't waste cpu cycles doing the same work over again

FAQ

Q. What environments are supported?

All browsers are supported, modern browsers such as Chrome, Safari, Opera, IE11, and Firefox have full web worker support and will give the best performance. Older browsers including Internet Explorer 10 & Internet Explorer 9 are supported by using a legacy processor fallback, these computations will be run on the main thread however they still follow the same library process and will be a seamless transition to the end user.

React Native is supported as well unfortunately this has only officially been tested against when using Android devices as IOS implements a security check preventing proper library operation, this will hopefully change in the future.

Node.js is also supported, you should be aware that Node.js does not ship with a native worker implementation and you will need to use a third party implementation that adheres to the worker spec. Without a third party worker implementation you will still be able to use the library however the library will be operating in legacy mode and all computations will be running on the main thread.

Q. How many threads can an X core processor use?

When initialized the library will attempt to detect the number of available logical cores on a clients machine and will formulate a maximum concurrent thread count based on that value, in the event that the library is unable to detect a valid core count it will fallback to a maxThread count of 4.

Depending on the browser used this count may be limited to a per origin maximum of 20 threads, the library itself does not impose any limitations on how many threads one can use. Although we do not recommend doing this thread counts of over 500 have been succesfully tested using Chrome.

When not making use of persistence mode, the library will automatically pool and manage execution across all available threads automatically scaling based on demand, and will destroy threads when they do not have pending work to complete, otherwise explicit threads are reused. With persistence mode enabled the library will instantiate all available threads on initialization and simply reuse them.