Bug 90276

Summary: Optimize Element::getAttributeNS() by replacing String with AtomicString
Product: WebKit Reporter: Kentaro Hara <haraken>
Component: DOMAssignee: Kentaro Hara <haraken>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, cmarcelo, rniwa, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 90246    
Attachments:
Description Flags
Performance test
none
Updated performance test
none
Patch none

Description Kentaro Hara 2012-06-29 05:37:11 PDT
In r121439, we changed the argument type of Element::getAttribute() from String to AtomicString for optimization. We can also change the argument type of Element::getAttributeNS() from String to AtomicString.

Actually this change affects V8 performance only.

[JSC without the patch]
The binding code converts a given JavaScript string to a String -> the String is passed to getAttributeNS() -> the String is converted to an AtomicString when it is passed to QualifiedName() constructor.

[JSC with the patch]
The binding code converts a given JavaScript string to a String -> the String is converted to an AtomicString when it is passed to getAttributeNS() -> the AtomicString is passed to QualifiedName() constructor.

[V8 without the patch]
The binding code retrieves a cached external String for a given JavaScript string -> the String is passed to getAttributeNS() -> the String is converted to AtomicString when it is passed to QualifiedName() constructor.

[V8 with the patch]
The binding code retrieves a cached external AtomicString for a given JavaScript string -> the AtomicString is passed to getAttributeNS() -> the AtomicString is passed to QualifiedName() constructor.

In this way, in JSC, the change affects where a String is converted to an AtomicString. On the other hand, in V8, (since the AtomicString is already cached,) we can skip the conversion step.
Comment 1 Kentaro Hara 2012-06-29 05:38:20 PDT
Created attachment 150156 [details]
Performance test
Comment 2 Kentaro Hara 2012-06-29 05:43:32 PDT
Created attachment 150158 [details]
Updated performance test
Comment 3 Kentaro Hara 2012-06-29 05:44:36 PDT
Created attachment 150159 [details]
Patch
Comment 4 Adam Barth 2012-07-27 01:05:18 PDT
Comment on attachment 150159 [details]
Patch

Based on further discussion in #webkit, my current understanding is that ap is ok with these patches.  I'm going to r+ them, but please give ap a chance to respond before landing.
Comment 5 WebKit Review Bot 2012-07-27 18:21:31 PDT
Comment on attachment 150159 [details]
Patch

Clearing flags on attachment: 150159

Committed r123944: <http://trac.webkit.org/changeset/123944>
Comment 6 WebKit Review Bot 2012-07-27 18:21:35 PDT
All reviewed patches have been landed.  Closing bug.