[webkit-dev] Making more use of ScriptWrappable

Adam Barth abarth at webkit.org
Thu Nov 1 11:04:06 PDT 2012

On Thu, Nov 1, 2012 at 10:51 AM, Alexey Proskuryakov <ap at apple.com> wrote:
> 01.11.2012, в 10:36, Adam Barth <abarth at webkit.org> написал(а):
>> Today, we use ScriptWrappable for Nodes only, but we would benefit by
>> making more use of ScriptWrappable, particularly for DOM objects that
>> almost always have JavaScript wrappers.  For example, XMLHttpRequest
>> objects exist only when created by script, which means that every
>> XMLHttpRequest object has a JavaScript wrapper.
> This looks like a great idea for investigation to me.
> Do you have a rough estimate of how large of a win we are talking about?

I don't have numbers currently, but I'm happy to gather some.  My
recollection is that the win for nodes was substantial on DOM
benchmarks.  I would expect the win to be fairly large for DOM objects
like NodeList where script is likely to access properties like length
and item frequently (e.g., in a loop).

> For example, XMLHttpRequests are probably not numerous enough to matter. Also, this would not be an improvement for XMLHttpRequest  objects created in secondary worlds.

Yeah.  This is a main-world optimization only.  Even for Nodes, we use
a HashMap for secondary worlds.


> I expect there to be cases where the win is more clear though.
> - WBR, Alexey Proskuryakov

More information about the webkit-dev mailing list