On Fri, 11 Mar 2011 16:48:04 +0100, Charles Kendrick
<[email protected]> wrote:
Just connecting the dots - I addressed this in my first email on the
subject. While it superficially sounds like a good compromise, I
actually think it's the worst possibility: it requires browser vendors
to implement limited order preservation, preventing deeper optimizations
like sorted keys.
Implementors already have to do that. In V8, some objects have their
properties backed by a hashmap. This just means that it needs an extra
field
in that hashmap (a 50% increase in size) to store the insertion index, and
then
extract and sort the keys by insertion index before iterating over them.
That also means that some ideas that might work well in one implementation,
like:
function hasKey(object) { for(var _ in object) return true; return
false; }
(which I believe works quickly in SpiderMonkey) will work much worse in
other
implementations - by at least a factor of 10.
So yes, (some) objects are hashmaps ... plus some more.
/L 'firmly in the "they are not ordered and never were, damnit!" camp'
--
Lasse Reichstein - [email protected]
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss