On Sun, Dec 23, 2012 at 12:09 PM, <[email protected]> wrote:

> What's the perfrmance difference between creating objects and arrays?
> Common sense makes me believe that arrays would be quicker because there's
> less to them internally.


Why would there be "less to them internally", whatever that means? As you
probably know, in JavaScript, objects and arrays are almost the same,
except for arrays' magic "length" property. V8 does have some differing
optimization techniques for them, which are mainly based on what they're
typically used for (in essence, object = bunch of unrelated properties and
methods; array = collection of similar things e.g. numbers).


> Is ths the case? And is it a big enough issue to effect performance when
> creating complex or large arrays/obects?
>

The only way to be sure whether or not something affects your application
is to try both and measure the difference. If you can't measure it, it's
not relevant.

Also, complex things in general tend to be expensive.

I am refering to javascript arrays and objects internally within the v8
> api, not within scriptland.
>

What? A library's API is its interface to the outside world, what does
"internally within the API" mean? How can JavaScript objects *not* be in
"script land"?

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to