Updates:
        Summary: Array.shift() is "slow" (O(n)) for arrays in LO space

Comment #1 on issue 3059 by [email protected]: Array.shift() is "slow" (O(n)) for arrays in LO space
http://code.google.com/p/v8/issues/detail?id=3059

The GC has nothing to do with this, and nothing is stalling either.

Array.shift() is an expensive operation, as it requires all array elements to be moved. For most areas of the heap, V8 has implemented a special trick to hide this cost: it simply bumps the pointer to the beginning of the object by one, effectively cutting off the first element. However, when an array is so large that it must be placed in "large object space", this trick cannot be applied as object starts must be aligned, so on every .shift() operation all elements must actually be moved in memory.

I'm not sure there's a whole lot we can do about this. If you want a "Queue" object in JavaScript with guaranteed O(1) complexity for .enqueue() and .dequeue() operations, you may want to implement your own.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to