parall threads (v3)

Revision 3 of this benchmark created by Calvin on


Description

parallel.js vs communist.js this is a 'fair test' that use creates and closes the workers each time. This test uses them idiomatically.

Preparation HTML

<script src="https://rawgithub.com/adambom/parallel.js/master/lib/parallel.js"></script><script src="https://rawgithub.com/calvinmetcalf/communist/master/dist/communist.min.js"></script>
<script>
var square = function (n) { 
    return n * n;
};
</script>

Setup

var a = [];
    while(a.length<50){
    a.push( Math.random()*100);
    }

Test runner

Ready to run.

Testing in
TestOps/sec
communist
// async test
var w = communist({data:square},4);
w.batch.data(a).then(function(){return w.close()}).then(function(){deferred.resolve()});
ready
paralell
// async test
var p = new Parallel(a);
p.map(square,{maxWorkers:4}).then(function(){deferred.resolve()});
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.