fib nomal vs asm.js (v6)

Revision 6 of this benchmark created on


Setup

var fibNomal = function fib(x) {

    'use strict';
    if (x < 3) return 1;
    return fib(x - 2) + fib(x - 1);
  };
  
  var fibUseAsm = (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(30);
ready
fib use asm
fibUseAsm(30);
ready

Revisions

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