fib nomal vs asm.js (v9)

Revision 9 of this benchmark created on


Setup

var fibNomal = function fib(x) {
    if (x < 3) return 1;
    return fib(x - 2) + fib(x - 1);
  };
  
  var fibAsmjs = (function () {

    'use asm';
    function fib(x) {
      x = x|0;
      if ((x|0) < 3) return 1;
      return ((fib((x - 2)|0)|0) + (fib((x - 1)|0)|0))|0;
    }
    return fib;
  })();

Test runner

Ready to run.

Testing in
TestOps/sec
fib nomal
fibNomal(20);
ready
fib asm.js
fibAsmjs(20);
ready

Revisions

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