let vs var performance

JavaScript performance comparison

Revision 14 of this test case created

Preparation code

<script type="application/javascript">
/*<![CDATA[[*/
  (function() {
    'use strict';
    let available;
  })();
/*]]>*/
</script>

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Let
(function() {
  'use strict';
  for ( let i = 0, l = 42; i < l; i += .05 );
})();
pending…
Var
(function() {
  'use strict';
  for ( var i = 0, l = 42; i < l; i += .05 );
})();
pending…
Param
(function(i,l) {
  'use strict';
  for ( i = 0, l = 42; i < l; i += .05 );
})();
pending…
Throw
(function() {
  'use strict';
  try { throw 0; } catch (i) {
  try { throw 42; } catch (l) {
    for ( ; i < l; i += .05 );
  }}
})();
pending…
Argument
(function(i,l) {
  'use strict';
  for ( ; i < l; i += .05 );
})(0,42);
pending…
Var Const
(function() {
  'use strict';
  const l = 42;
  for ( var i = 0; i < l; i += .05 );
})();
pending…
Let + Const
(function() {
  'use strict';
  const l = 42;
  for ( let i = 0; i < l; i += .05 );
})();
pending…
Throw + Const
(function() {
  'use strict';
  const l = 42;
  try { throw 0; } catch (i) {
    for ( ; i < l; i += .05 );
  }
})();
pending…
Argument + Const
(function(i) {
  'use strict';
  const l = 42;
  for ( ; i < l; i += .05 );
})(0);
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. Here’s a list of current revisions for this page:

0 comments

Add a comment