On Tue, Jan 25, 2011 at 6:52 PM, Adrian Olaru <[email protected]> wrote:

> Hi guys,
>
> we all know that we can declare variables and 2 ways
>
> var x=1, y=2, z=3;
>
> or
>
> var x=1; var y=2; var z=3;
>
>
> Now, we can see that the 1st version is smaller and minification friendly,
> but is it faster?
>
>
Since all variables are created before the function is executed, the
difference is never something you can take for granted. There is absolutely
zero difference in either way of declaring vars. Purely a parser issue. And
it's typically something that'll change on a day-to-day basis. And whatever
difference there is, will be so minimal it's not worth it as an argument for
whatever you want to decide.

Also, 10k runs of a function declaring variables is not enough. I would
expect that to be optimized to heck by browsers, rendering your results
useless. Try jsperf?

- peter

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to