(Question moved from Webmasters.)
Someone once told me that it's better for Javascript performance to use one var statement rather then multiple.
I.e.
// Version A. Allegedly Faster var a = 1, b = 2, c = 3; // Version B. Allegedly Slower var a = 1; var b = 2; var c = 3; The reasoning behind this was along the lines of: For every var statement, Javascript will start allocating memory and then stop at the semicolon. Whereas, if you have only one var statement, many JS implementations will optimize it and allocate space for all variables in the same call. Thus making things go faster.
However, when googling to confirm this I only find rants about how some consider the second example to be simpler from a maintenance point of view. And some disagree. This JSPerf test sais there is no difference.
So my question: From a performance perspective, is there any reason version A or B would be better?
(You do save a few bytes on not writing the "var" declaration, but that is in delivery of data to a browser. This question includes server side JS)