Now I am optimizing querySelector() (bug 87625). We want to add a performance test for querySelector().
Created attachment 144550 [details] Patch
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.
(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.)
Created attachment 144713 [details] patch for landing
Comment on attachment 144713 [details] patch for landing Clearing flags on attachment: 144713 Committed r118899: <http://trac.webkit.org/changeset/118899>