Bug 87742

Summary: [perf-test] Add a benchmark for querySelector()
Product: WebKit Reporter: Kentaro Hara <haraken>
Component: Tools / TestsAssignee: Kentaro Hara <haraken>
Status: RESOLVED FIXED    
Severity: Normal CC: koivisto, rniwa, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
patch for landing none

Description Kentaro Hara 2012-05-29 07:00:33 PDT
Now I am optimizing querySelector() (bug 87625). We want to add a performance test for querySelector().
Comment 1 Kentaro Hara 2012-05-29 07:09:34 PDT
Created attachment 144550 [details]
Patch
Comment 2 Ryosuke Niwa 2012-05-29 12:21:42 PDT
Comment on attachment 144550 [details]
Patch

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

We probably want one more case where the node is deep in the tree (i.e. 20-50 levels of nesting).

> PerformanceTests/Parser/query-selector-last.html:5
> +</body>

Why are you closing body here?

> PerformanceTests/Parser/query-selector-last.html:7
> +for (var i = 0; i < 1000; i++) {

Is 1000 enough to make a difference?

> PerformanceTests/Parser/query-selector-last.html:11
> +  var div = document.createElement("div");
> +  div.id = "foo";
> +  div.className = "bar";
> +  document.body.appendChild(div);

Nit: 2-space indentation.
Comment 3 Kentaro Hara 2012-05-29 16:58:30 PDT
(In reply to comment #2)
> We probably want one more case where the node is deep in the tree (i.e. 20-50 levels of nesting).

I am happy to add it if you want, but would there be any big difference between "a node at the tail of the long flat tree" (tested by query-selector-last.html) and "a node deeply nested in the tree"?

> > PerformanceTests/Parser/query-selector-last.html:7
> > +for (var i = 0; i < 1000; i++) {
> 
> Is 1000 enough to make a difference?

Yes. As I described in ChangeLog:

[query-selector-first.html]
        RESULT Parser: query-selector-first= 252.339803014 runs/s
        median= 253.646265594 runs/s, stdev= 2.32610873209 runs/s, min= 248.138957816 runs/s, max= 254.777070064 runs/s

[query-selector-last.html]
        RESULT Parser: query-selector-last= 356.009616076 runs/s
        median= 355.781448539 runs/s, stdev= 0.841519086864 runs/s, min= 354.430379747 runs/s, max= 358.056265985 runs/s

Note that the loop count of query-selector-last.html is 1/10 of query-selector-first.html. (Maybe we should make the loop count the same, to compare the two results at a glance.)
Comment 4 Kentaro Hara 2012-05-29 23:17:20 PDT
Created attachment 144713 [details]
patch for landing
Comment 5 WebKit Review Bot 2012-05-30 00:01:09 PDT
Comment on attachment 144713 [details]
patch for landing

Clearing flags on attachment: 144713

Committed r118899: <http://trac.webkit.org/changeset/118899>