Ordering of JS properties

Darin Adler darin at apple.com
Mon Feb 16 23:45:18 CET 2004


On Feb 16, 2004, at 2:23 PM, Harri Porten wrote:

> Is this issue worth fixing?

Yes.

> The only solution - other than returning to the slow list - is to do 
> double book keeping with an index or list which will cause an 
> additional memory overhead.

We did this for Safari 1.0.

We did the work last June, and it was in JavaScriptCore-85, with a 
significant refinement in JavaScriptCore-88. The property map keeps an 
index that tracks the order properties are added, and sorts as needed. 
The tradeoff seems to be working fine.

This is one of the differences that exists between TOT kjs and 
JavaScriptCore after my current merging is done. I was planning to send 
a complete diff to this list with some comments about it.

But you don't have to wait. You can just check it out in our sources.

> Are there containers with the property of fast lookups while still 
> supporting iteration in the order of addition ? :)

There are all sorts of them, but I don't think there are any that are 
substantially better than what we did in JavaScriptCore.

SpiderMonkey has some super-sophisticated and super-hard-to-understand 
way of doing this. I wasn't even able to understand the comments in the 
code.

     -- Darin



More information about the Khtml-devel mailing list