multiple vs single var declarations

JavaScript performance comparison

Revision 2 of this test case created by deVars

Info

added arrays and objects in the mix

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
single var
var foo = 'foo',
    bar = 'bar',
    baz = 42,
    fooObj = {foo: 'foo', baz: 1, bar: ['baz', 'bar']},
    fooArr = ['foo', 'baz', 1, {bar: 'bar'}];
pending…
multiple var
var foo = 'foo';
var bar = 'bar';
var baz = 42;
var fooObj = {foo: 'foo', baz: 1, bar: ['baz', 'bar']};
var fooArr = ['foo', 'baz', 1, {bar: 'bar'}];
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