Status: New
Owner: ----
New issue 1800 by [email protected]: Wanted: Efficient way to count the
number of properties in an Object
http://code.google.com/p/v8/issues/detail?id=1800
Counting the number of properties in an array is easy and efficient: use
the `length` property.
Counting the number of properties in an object "should be" easy and
efficient. As I understand it, it is not. Objects in JavaScript should
serve their second purpose as associative arrays, and therefore, should
contain a way to determine the number of keys in an Object in constant time
(independent of the number of properties in an Object). Many documented
methods (i.e. Object.keys(obj).length) run in linear time.
Is there any way to do this in constant time by storing the number of
properties with each Object? Maybe only store this information
for "larger" Objects to save memory?
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev