two-closures

JavaScript performance comparison

Test case created

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
oneClosue
function oneClosure(x, y, z) {
    var i = x + y;
    var j = y + z;
    return i + j;
};

function twoClosures(x, y, z) {
    return (function(i, j){ return i + j; })(x+y, y+z);
};

for(var i=0; i < 10000; i++) {
   oneClosure(1, 2, 3);
}
pending…
twoClosures
function oneClosure(x, y, z) {
    var i = x + y;
    var j = y + z;
    return i + j;
};

function twoClosures(x, y, z) {
    return (function(i, j){ return i + j; })(x+y, y+z);
};

for(var i=0; i < 10000; i++) {
    twoClosures(1, 2, 3);
}
pending…

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

Compare results of other browsers

0 comments

Add a comment