function expression or declaration

JavaScript performance comparison

Revision 5 of this test case created

Info

Testing if function expressions produce more garbage.

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
function expression w/o closure
var test = function() {
    var a = function() {
          return "do something";
        };
    return a
};

test();
pending…
function declaration w/o closure
var test = function() {
    function a() {
      return "do something";
    };
    return a
};

test();
pending…
function expression w/ closure
var a = function() {
    return "do something";
};
var test = function() {
    return a
};

test();
pending…
function declaration w/ closure
function a() {
  return "do something";
};
var test = function() {
    return a
};

test();
pending…
named function declaration w/o closure
var test = function() {
    var a = function a() {
        return "do something";
    };
    return a
};

test();
pending…
named function declaration w/ closure
var a = function a() {
    return "do something";
};
var test = function() {
    return a
};

test();
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