memory js

JavaScript performance comparison

Revision 2 of this test case created

Info

js memory coding

Preparation code

<html><body></body></html>
 

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
no-memory
// async test
var fibonacci = function(n) {
  return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2);
};
for (var i = 0; i <= 10; i++) {
  document.writeln('// ' + i + ': ' + fibonacci(i));
}
pending…
memory
// async test
var fibonacci = function() {
  var memo = [0, 1];
  var fib = function() {
    var result = memo[n];
    if (typeof result !== 'number') {
      result = fib(n - 1) + fib(n - 2);
      memo[n] = result;
    }
    return result;
  };
  return fib;
}();

for (var i = 0; i <= 10; i++) {
  document.writeln('// ' + i + ': ' + fibonacci(i));
}
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