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 modern browsers are supported. Chrome, Safari, Opera, IE11, and Firefox have full support and will give the best performance. Older browsers including Internet Explorer 9 and 10 are supported by using a legacy processor fallback, these computations will be run on the main thread only however they still follow the same library process and is a seamless transition to the end user.

React Native is supported as well but will currently operate in legacy mode and computations will be run on the main thread only, once the ReactNative project fixes support for data blobs the library will be able to make use of multiple threads.

Node.js is also supported, you should however be aware that Node.js does not ship with a native worker implementation and will operate in legacy mode. To resolve this you will need to use a third party implementation that adheres to the worker spec, once you've included a third party implementation the library will automatically make use of multiple threads.

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, 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.

Q. What increase in performance can I see?

Performance improvements are highly dependent on not just the task being executed but the client machine handling the execution. Parallelism almost never provides perfect scaling (eg. 2 threads gets things done in exactly half the time) however in general you should see worthwhile performance improvements for problems that can make use of parallelism. And an increase in overall compute capability by spreading problems that can't be parallelized across a pool of threads.