Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Issue 18732004: Add fast path for querySelector(All) (Closed)

Created:
7 years, 5 months ago by tasak
Modified:
7 years, 4 months ago
Reviewers:
haraken, esprehn
CC:
blink-reviews, dglazkov+blink, eae+blinkwatch, adamk+blink_chromium.org
Visibility:
Public.

Description

Add fast path for querySelector(All) with id selector, class selector and tag selector. Adding class selector in the same manner as id selector. So I implemented offline (not live node list) getElementsByClassName in SelectorQuery.cpp. However, this also affects performance regressions of Parser/query-selector-*.html. So added more fast path for querySelector(All) with one simple selector (only id selector, class selector or tag selector). BUG=253425 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=155068

Patch Set 1 #

Total comments: 7

Patch Set 2 : #

Total comments: 1

Patch Set 3 : #

Patch Set 4 : #

Total comments: 22

Patch Set 5 : #

Total comments: 2

Patch Set 6 : Patch for landing #

Patch Set 7 : Fix mac build failure #

Patch Set 8 : Patch for landing (rebased) #

Unified diffs Side-by-side diffs Delta from patch set Stats (+416 lines, -79 lines) Patch
A LayoutTests/fast/dom/SelectorAPI/dumpNodeList-2.html View 1 2 3 4 5 1 chunk +48 lines, -0 lines 0 comments Download
A LayoutTests/fast/dom/SelectorAPI/dumpNodeList-2-expected.txt View 1 1 chunk +11 lines, -0 lines 0 comments Download
A + PerformanceTests/Parser/query-selector-all-class-deep.html View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
A + PerformanceTests/Parser/query-selector-all-class-first.html View 1 2 3 4 1 chunk +2 lines, -4 lines 0 comments Download
A + PerformanceTests/Parser/query-selector-all-class-last.html View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
A + PerformanceTests/Parser/query-selector-all-deep.html View 1 2 3 4 1 chunk +4 lines, -2 lines 0 comments Download
A + PerformanceTests/Parser/query-selector-all-first.html View 1 2 3 4 1 chunk +4 lines, -4 lines 0 comments Download
A + PerformanceTests/Parser/query-selector-all-id-deep.html View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
A + PerformanceTests/Parser/query-selector-all-id-first.html View 1 2 3 4 1 chunk +2 lines, -4 lines 0 comments Download
A + PerformanceTests/Parser/query-selector-all-id-last.html View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
A + PerformanceTests/Parser/query-selector-all-last.html View 1 2 3 4 1 chunk +4 lines, -4 lines 0 comments Download
M Source/core/dom/SelectorQuery.h View 1 2 3 4 5 6 7 2 chunks +13 lines, -3 lines 0 comments Download
M Source/core/dom/SelectorQuery.cpp View 1 2 3 4 5 6 7 3 chunks +320 lines, -50 lines 0 comments Download

Messages

Total messages: 23 (0 generated)
tasak
7 years, 5 months ago (2013-07-08 05:26:07 UTC) #1
haraken
The change looks OK. Do you have any performance number about the original bug? https://codereview.chromium.org/18732004/diff/1/LayoutTests/fast/dom/SelectorAPI/dumpNodeList-2.html ...
7 years, 5 months ago (2013-07-08 06:13:16 UTC) #2
tasak
> Do you have any performance number about the original bug? before applying this patch: ...
7 years, 5 months ago (2013-07-08 09:46:17 UTC) #3
haraken
LGTM
7 years, 5 months ago (2013-07-08 10:17:23 UTC) #4
haraken
https://codereview.chromium.org/18732004/diff/8005/Source/core/dom/SelectorQuery.cpp File Source/core/dom/SelectorQuery.cpp (right): https://codereview.chromium.org/18732004/diff/8005/Source/core/dom/SelectorQuery.cpp#newcode169 Source/core/dom/SelectorQuery.cpp:169: RefPtr<NodeList> nodeList = rootNode->getElementsByClassName(selector->value()); oh, this will create unexpected ...
7 years, 5 months ago (2013-07-08 11:33:46 UTC) #5
tasak
On 2013/07/08 11:33:46, haraken wrote: > https://codereview.chromium.org/18732004/diff/8005/Source/core/dom/SelectorQuery.cpp > File Source/core/dom/SelectorQuery.cpp (right): > > https://codereview.chromium.org/18732004/diff/8005/Source/core/dom/SelectorQuery.cpp#newcode169 > ...
7 years, 5 months ago (2013-07-09 03:24:06 UTC) #6
tasak
Since ClassNodeList uses ElementTraversal, added ElementTraversal for class selector to findTraverseRoot. Now 129,280±3.40% 13% slower ...
7 years, 5 months ago (2013-07-11 08:41:44 UTC) #7
haraken
+esprehn: would you take a look?
7 years, 5 months ago (2013-07-11 11:02:06 UTC) #8
esprehn
On 2013/07/11 11:02:06, haraken wrote: > +esprehn: would you take a look? This is going ...
7 years, 5 months ago (2013-07-12 00:55:10 UTC) #9
tasak
On 2013/07/12 00:55:10, esprehn wrote: > On 2013/07/11 11:02:06, haraken wrote: > > +esprehn: would ...
7 years, 5 months ago (2013-07-12 05:11:27 UTC) #10
tasak
> What do you think about this idea? The Patch Set 4 shows my idea.
7 years, 5 months ago (2013-07-12 06:19:46 UTC) #11
esprehn
https://codereview.chromium.org/18732004/diff/24001/Source/core/dom/SelectorQuery.cpp File Source/core/dom/SelectorQuery.cpp (right): https://codereview.chromium.org/18732004/diff/24001/Source/core/dom/SelectorQuery.cpp#newcode107 Source/core/dom/SelectorQuery.cpp:107: if (firstMatchOnly) I'd rather you just created two methods. ...
7 years, 5 months ago (2013-07-12 07:17:16 UTC) #12
tasak
Thank you for reviewing. I found performance regressions of Parser/query-selector-first (existing one) and Parser/query-selector-all-first (newly ...
7 years, 5 months ago (2013-07-16 07:46:59 UTC) #13
tasak
I ran performance tests and obtained the results: Result Test Unit before after /Parser/query-selector-all-class-deep:Runs runs/s ...
7 years, 5 months ago (2013-07-16 09:01:42 UTC) #14
esprehn
Sorry about the delay, I'll review this asap.
7 years, 5 months ago (2013-07-19 20:15:51 UTC) #15
esprehn
LGTM. This looks much better. It's unfortunate we need to add so much code for ...
7 years, 5 months ago (2013-07-25 23:11:26 UTC) #16
tasak
Thank you, esprehn. https://codereview.chromium.org/18732004/diff/29001/LayoutTests/fast/dom/SelectorAPI/dumpNodeList-2.html File LayoutTests/fast/dom/SelectorAPI/dumpNodeList-2.html (right): https://codereview.chromium.org/18732004/diff/29001/LayoutTests/fast/dom/SelectorAPI/dumpNodeList-2.html#newcode24 LayoutTests/fast/dom/SelectorAPI/dumpNodeList-2.html:24: return this; On 2013/07/25 23:11:27, esprehn ...
7 years, 5 months ago (2013-07-26 04:38:52 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tasak@google.com/18732004/40001
7 years, 5 months ago (2013-07-26 04:40:32 UTC) #18
commit-bot: I haz the power
Sorry for I got bad news for ya. Compile failed with a clobber build on ...
7 years, 5 months ago (2013-07-26 05:23:25 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tasak@google.com/18732004/54001
7 years, 5 months ago (2013-07-26 08:06:33 UTC) #20
commit-bot: I haz the power
Step "update" is always a major failure. Look at the try server FAQ for more ...
7 years, 5 months ago (2013-07-26 10:39:14 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tasak@google.com/18732004/64001
7 years, 4 months ago (2013-07-29 02:06:12 UTC) #22
commit-bot: I haz the power
7 years, 4 months ago (2013-07-29 03:34:15 UTC) #23
Message was sent while issue was closed.
Change committed as 155068

Powered by Google App Engine
This is Rietveld 408576698