performance testing of named or anonymous functions (v52)

Revision 52 of this benchmark created by Sakatox on


Test runner

Ready to run.

Testing in
TestOps/sec
var named function expression
var i = 0;
for (; i < 100000; ++i) {
    var x = function namedFunction() {
        const queryString = window.parseQueryString(window.location.search);
        if (queryString && queryString["bs"]) {
            var bs = queryString["bs"];
            if (bs && new RegExp("[0-9]*~[0-9]*/[0-9]*~[0-9]*").exec(bs).length === 1) {
                if (window.bsApp) {
                    var construct = bs.split("~");
                    window.bsApp.addBet("fp={0}#o={1}#st={2}".format(construct[0], construct[1], construct[2]));
                }
            }
        }
};
x();
}
ready
let function declr
let i = 0;
for (; i < 100000; ++i) {
  (function () {
        const queryString = window.parseQueryString(window.location.search);
        if (queryString && queryString["bs"]) {
            var bs = queryString["bs"];
            if (bs && new RegExp("[0-9]*~[0-9]*/[0-9]*~[0-9]*").exec(bs).length === 1) {
                if (window.bsApp) {
                    var construct = bs.split("~");
                    window.bsApp.addBet("fp={0}#o={1}#st={2}".format(construct[0], construct[1], construct[2]));
                }
            }
        }
    }());
}
ready
let function expression
var i = 0,
myEventHandler = function() {
        const queryString = window.parseQueryString(window.location.search);
        if (queryString && queryString["bs"]) {
            var bs = queryString["bs"];
            if (bs && new RegExp("[0-9]*~[0-9]*/[0-9]*~[0-9]*").exec(bs).length === 1) {
                if (window.bsApp) {
                    var construct = bs.split("~");
                    window.bsApp.addBet("fp={0}#o={1}#st={2}".format(construct[0], construct[1], construct[2]));
                }
            }
        }
}

for (; i < 100000; ++i) {
  var x = myEventHandler();
}
ready
let anonymous func
let i = 0;
for (; i < 100000; ++i) {
 var x = function() {
        const queryString = window.parseQueryString(window.location.search);
        if (queryString && queryString["bs"]) {
            var bs = queryString["bs"];
            if (bs && new RegExp("[0-9]*~[0-9]*/[0-9]*~[0-9]*").exec(bs).length === 1) {
                if (window.bsApp) {
                    var construct = bs.split("~");
                    window.bsApp.addBet("fp={0}#o={1}#st={2}".format(construct[0], construct[1], construct[2]));
                }
            }
        }
};
x();
}
ready
let named function expression
let i = 0;
for (; i < 100000; ++i) {
    var x = function namedFunction() {
        const queryString = window.parseQueryString(window.location.search);
        if (queryString && queryString["bs"]) {
            var bs = queryString["bs"];
            if (bs && new RegExp("[0-9]*~[0-9]*/[0-9]*~[0-9]*").exec(bs).length === 1) {
                if (window.bsApp) {
                    var construct = bs.split("~");
                    window.bsApp.addBet("fp={0}#o={1}#st={2}".format(construct[0], construct[1], construct[2]));
                }
            }
        }
};
x();
}
ready
var function declr
var i = 0;
for (; i < 100000; ++i) {
  (function () {
        const queryString = window.parseQueryString(window.location.search);
        if (queryString && queryString["bs"]) {
            var bs = queryString["bs"];
            if (bs && new RegExp("[0-9]*~[0-9]*/[0-9]*~[0-9]*").exec(bs).length === 1) {
                if (window.bsApp) {
                    var construct = bs.split("~");
                    window.bsApp.addBet("fp={0}#o={1}#st={2}".format(construct[0], construct[1], construct[2]));
                }
            }
        }
    }());
}
ready

Revisions

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