[webkit-dev] JS binding wapper pointers: inline vs. separate hash table

Geoffrey Garen ggaren at apple.com
Wed Oct 1 10:50:57 PDT 2008


>> If we believe that JS wrappers are relatively uncommon, we can  
>> store them in a Node's "rare data" structure, and bloat only those  
>> uncommon nodes that have JS wrappers.
>
> Depending on exactly how common they are, this could be more net  
> memory use, if it causes Nodes to have a NodeRareData structure that  
> wouldn't otherwise.
>
>> If we believe that JS wrappers are relatively common, we can store  
>> them directly in a Node, since putting them in a hashtable is net  
>> more memory use.
>
> I think only a minority of nodes have wrappers, but on at least some  
> pages it is likely to be a sizable minority. I did not measure  
> though - should have.

I should also mention Sam's suggestion, which I think is pretty good:  
All HTMLElements (or perhaps all Elements) get embedded pointers to  
their wrappers, since JavaScript traversal of a document is relatively  
common. All other DOM objects, including generic nodes, use a hash  
table.

Geoff


More information about the webkit-dev mailing list