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

Maciej Stachowiak mjs at apple.com
Wed Oct 1 02:27:55 PDT 2008


On Oct 1, 2008, at 1:46 AM, Geoffrey Garen wrote:

>> In the Chrome tree, every object inheriting from RefCounted incurs  
>> an extra pointer in size, but this is clearly more than necessary  
>> since many RefCounted objects do not have bindings.
>
> 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.

> Non-Node wrappers are another story. Perhaps they are all uncommon  
> enough to go in a hash table.

I strongly suspect that is the case. On many of these sites, the  
number of CSSOM objects (inheriting from StyleBase) and NamedAttrMaps  
outnumbered the count of Nodes, and it is relatively rare to deal with  
such objects from JS.

Regards,
Maciej



More information about the webkit-dev mailing list