global vs local window

JavaScript performance comparison

Test case created by Jack

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
window is global
void function() {
    var x;

    for (var i = 0; i < 5000; ++i) {
        x = window.location;
    }
}();
pending…
window is local
void function(window) {
    var x;

    for (var i = 0; i < 5000; ++i) {
        x = window.location;
    }
}(window);
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

1 comment

RobG commented :

IE 8 results are bogus as the script alert appeared multiple times, eventually it crashed. Seems jsperf isn't IE friendly.

Add a comment