Duplicate vars vs single var

Benchmark created by James Wilkins on


Setup

function test1() {
      var _ = 1;
      var _ = null;
      var _ = true;
      var _ = "";
      var _ = undefined;
    }
    
    function test2() {
      var _;
      _ = 1;
      _ = null;
      _ = true;
      _ = "";
      _ = undefined;
    }

Test runner

Ready to run.

Testing in
TestOps/sec
Duplicate vars
test1()
ready
Single declaration
test2()
ready

Revisions

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

  • Revision 1: published by James Wilkins on