performance testing of named or anonymous functions (v31)

Revision 31 of this benchmark created on


Description

a small comparision betwean named function and function declaration

Test runner

Ready to run.

Testing in
TestOps/sec
anonymous
"use strict";

class Test() {
    testFunc() {
    }
}

var a = new Test();

for (var i = 0; i < 1000; ++i) {
  a.testFunc();
}
ready
function expression
"use strict";

function Test() {
    this.testFunc = function () {
    }
}

var a = new Test();

for (var i = 0; i < 1000; ++i) {
  a.testFunc();
}
ready
function declaration
"use strict";

function testFunc() {
}
function Test() {
    this.testFunc = testFunc;
}

var a = new Test();

for (var i = 0; i < 1000; ++i) {
  a.testFunc();
}
ready

Revisions

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