Bug 80506

Summary: [V8][Performance] Optimize Element.firstElementChild, Element.lastElementChild, Element.previousElementSibling, Element.nextElementSibling, Node.parentElement
Product: WebKit Reporter: Kentaro Hara <haraken>
Component: WebCore JavaScriptAssignee: Kentaro Hara <haraken>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, arv, japhet, ojan, rakuco, rniwa, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Performance tests
none
Patch none

Description Kentaro Hara 2012-03-07 04:00:59 PST
Element.firstElementChild, Element.lastElementChild, Element.previousElementSibling, Element.nextElementSibling and Node.parentElement of V8 are much slower than JSC. We should optimize them.

The results of the attached performance tests are as follows in my local Mac environment :

AppleWebKit/Safari:
div.firstElementChild : 1162ms
div.lastElementChild : 1016ms
div.previousElementSibling : 918ms
div.nextElementSibling : 900ms
div.parentElement : 901ms

Chromium/V8:
div.firstElementChild : 9515ms
div.lastElementChild : 9449ms
div.previousElementSibling : 9254ms
div.nextElementSibling : 9315ms
div.parentElement : 9380ms
Comment 1 Kentaro Hara 2012-03-07 04:01:38 PST
Created attachment 130594 [details]
Performance tests
Comment 2 Kentaro Hara 2012-03-07 04:05:14 PST
Created attachment 130595 [details]
Patch
Comment 3 Adam Barth 2012-03-07 10:09:56 PST
Comment on attachment 130595 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=130595&action=review

> Source/WebCore/ChangeLog:11
> +        This patch improves the performance of Element.firstElementChild by 5.8 times,
> +        Element.lastElementChild by 6.2 times, Element.previousElementSibling by 7.1 times,
> +        Element.nextElementSibling by 7.1 times, and Node.parentElement by 6.7 times.

Wow
Comment 4 WebKit Review Bot 2012-03-07 14:37:17 PST
Comment on attachment 130595 [details]
Patch

Clearing flags on attachment: 130595

Committed r110106: <http://trac.webkit.org/changeset/110106>
Comment 5 WebKit Review Bot 2012-03-07 14:37:22 PST
All reviewed patches have been landed.  Closing bug.