FP algo

JavaScript performance comparison

Revision 2 of this test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    Array.prototype.gen = function(lenth) {
      for (var i = 0, result = Array(length); i < length; result[i++] = undefined);
      return result;
    }
   
    function fibo(n) {
   
      var f = [];
      for (var c = 0; c < n; ++c) {
        f.push((c < 2) ? c : f[c - 1] + f[c - 2]);
      }
      return f;
    }
   
    function fiboF(n) {
      //Array.apply(null, {length: n})
      [].gen(n)
      return n;
    }
};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
fibo classic
fibo(100)
pending…
fibo FP
fiboF(100)
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment