for-in evaluation order

Andreas Gal andreas.gal at gmail.com
Mon Dec 27 04:40:08 PST 2010


I can't speak for other VM implementors, but I think most implementors will not want to guarantee either enumeration method (property addition order vs numeric order). In some cases we store array data "dense", in others we punt and use a natural object representation. The decision when we switch between representations is a brittle heuristics. Allowing the underlying representation and along with it the enumeration order to bleed through is faster than normalizing (which in some cases would mean sorting property indexed names).

That having said, if TC39 decides to standardize enumeration order, I am pretty sure we can make pretty much any standard enumeration order reasonably fast (maybe a little less fast than before though). Mark suggested at some point enumerating indexed properties first in numeric order, and then all remaining properties. Its the most sensible approach I have heard so far. If someone drafts a proposal to standardize enumeration order, I volunteer to implement it in Firefox and get some performance data. That would help calming implementor's nerves.

Andreas

> 
> It's interesting. Could you summarize these objections?
> 
> Dmitry.
> 
>> Andreas
>> 
>> On Dec 27, 2010, at 12:52 PM, Michael Day wrote:
>> 
>>> Thanks Boris, Dmitry,
>>> 
>>>>> Are objects implicitly ordered, by implementation convention?
>>>> For implementations that have to deal with the web, yes.
>>> Okay, now I know what we have to do then :)
>>> 
>>> Might I suggest that this be added to the spec, if only in an informative note, to save future implementers the trouble?
>>> 
>>> Best regards,
>>> 
>>> Michael
>>> 
>>> -- 
>>> Print XML with Prince!
>>> http://www.princexml.com
>>> _______________________________________________
>>> es-discuss mailing list
>>> es-discuss at mozilla.org
>>> https://mail.mozilla.org/listinfo/es-discuss
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss



More information about the es-discuss mailing list