Single vs multiple vars

JavaScript performance comparison

Test case created

Info

Test to see if there are any performance gains from using a single or multiple vars at the top of a function scope.

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Multiple vars
var one = [];
var two = [];
var three = true;
var four = false;
var five = {
  test: 'one',
  testTwo: 'two'
};
var six = 'test';
var seven = null;
var eight;
pending…
Single
var one = [],
    two = [],
    three = true,
    four = false,
    five = {
      test: 'one',
      testTwo: 'two'
    },
    six = 'test',
    seven = null,
    eight;
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