let vs var

JavaScript performance comparison

Revision 3 of this test case created by

Preparation code

<script language="javascript" type="application/javascript;version=1.7">
window.onload = function() {
        var f = document.createDocumentFragment(),
            n = null;
        [].forEach.call(document.getElementsByTagName("script"), function(s) {
            n = s.nextSibling;
            f.appendChild(s);
            s.type = "application/javascript;version=1.7";
            s.setAttribute("language", "javascript");
            n.parentNode.insertBefore(f, n);
        });
};
</script>
    

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
let
;(function() {
    let letTest = "foo bar baz";
}());
pending…
var
;(function() {
    var varTest = "foo bar baz";
}());
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.

0 Comments