parallel.js fib (v2)

Revision 2 of this benchmark created by Jasper on


Preparation HTML

<script src="https://s3-us-west-2.amazonaws.com/intelpp/parallel.js"></script>

Setup

function fib(n) {
      return n < 2 ? 1 : fib(n - 1) + fib(n - 2);
    };
    
    var l = 1000;
    var data = [];
    while(l--) data.push((Math.random()*10)|0);
    
    var p = new Parallel(data);

Test runner

Ready to run.

Testing in
TestOps/sec
Serial
for(var i = 0, l = data.length; i < l; i++){
fib( data[ i ] );
}
ready
parallel.js
// async test
p.map(fib).then(function(){
    deferred.resolve();
});
ready

Revisions

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

  • Revision 2: published by Jasper on