Square Root Example

This example is designed to give an idea on how performance can scale using Hamsters.js, you can play around with different test sizes to see how scaling changes with problem size. Originally created specifically for development purposes, now available as a public example demonstrating the dynamic, concurrent, and stateless-ness nature of the Hamsters.js software package.

This is what would be considered an embarrassingly parallel problem, the provided example will generate an array containing the selected test size amount of randomly generated integers. After the random array is generated the benchmark will then loop through the data set multiple times, calculating the square root of every integer, each iteration increasing the number of threads used up until reaching the number of logical threads detected.

Once the benchmark is complete, it should render two graphs showing the relative performance change with the addition of each thread. Depending on the browser & hardware used you may see an increase in relative performance with a larger test size.

                      let params = {
                        array: [1...1000000]
                      hamsters.run(params, function() {
                        for (var i = 0; i < params.array.length; i++) {
                      }, function(results) {
                      }, function(error) {

Client Summary

  • Hamsters.js Version:
  • Maximum Threads:
  • Browser:
  • Legacy Mode:
  • Atomic Operations Support:
  • Transferable Object Support:

Test Size

Execution Time - Lower is better

Thread Scaling % Improvement - Higher is better