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

Issue 92083002: Add fast path for tag#id selector queries (Closed)

Created:
7 years ago by Inactive
Modified:
7 years ago
CC:
blink-reviews, dglazkov+blink, eae+blinkwatch, adamk+blink_chromium.org, lgombos
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

Add fast path for #id / tag#id selector queries Add fast path for #id / tag#id selector queries, even in the cases where the case where the document contains multiple elements with the same id. DocumentOrderedMap was updated so that the hash table values contain the ordered vector of all matching Elements (lazily populated). DocumentOrderedMap now supports getAllElementsById() operation in addition to the pre-existing getElementById() one. I see the following impact of BrowserMark test cases (Linux Desktop): 05_DOM_Create_Source: +190.5% (~2.9x better) 06_DOM_Dynamic_Create: +150.0% (~2.5x better) Those tests were spending most of their time traversing the tree due to the "div#hidden_playground" query. That query would go through the slow path because: - We did not support going through fast path for tag#id queries, only #id ones. - The id is not unique in the document. This is a partial merge of WebKit r150187 by <rniwa@webkit.org>;. R=esprehn BUG=323962 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=164102

Patch Set 1 #

Total comments: 12

Patch Set 2 : Fix clusterfuzz crash and remove FIXME comment #

Patch Set 3 : Fix clusterfuzz crash and remove FIXME comment #

Total comments: 6

Patch Set 4 : Take feedback into consideration #

Total comments: 2

Patch Set 5 : Move emptyVector #

Unified diffs Side-by-side diffs Delta from patch set Stats (+116 lines, -33 lines) Patch
M Source/core/dom/DocumentOrderedMap.h View 1 2 3 3 chunks +3 lines, -0 lines 0 comments Download
M Source/core/dom/DocumentOrderedMap.cpp View 1 2 3 4 3 chunks +34 lines, -2 lines 0 comments Download
M Source/core/dom/SelectorQuery.h View 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/dom/SelectorQuery.cpp View 1 2 3 5 chunks +67 lines, -31 lines 0 comments Download
M Source/core/dom/TreeScope.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/dom/TreeScope.cpp View 1 2 3 1 chunk +10 lines, -0 lines 0 comments Download

Messages

Total messages: 21 (0 generated)
Inactive
7 years ago (2013-11-27 17:11:36 UTC) #1
Inactive
On 2013/11/27 17:11:36, Chris Dumez wrote: FYI, the sources of these tests are visible at: ...
7 years ago (2013-11-27 18:37:06 UTC) #2
abarth-chromium
We've tried to merge these CLs before and gotten rejected by ClusterFuzz... esprehn, would you ...
7 years ago (2013-12-02 19:16:10 UTC) #3
Inactive
On 2013/12/02 19:16:10, abarth wrote: > We've tried to merge these CLs before and gotten ...
7 years ago (2013-12-02 19:24:11 UTC) #4
esprehn
On 2013/12/02 19:16:10, abarth wrote: > We've tried to merge these CLs before and gotten ...
7 years ago (2013-12-02 19:41:46 UTC) #5
abarth-chromium
On 2013/12/02 19:24:11, Chris Dumez (Away) wrote: > Is this something I can check before ...
7 years ago (2013-12-02 20:24:16 UTC) #6
Inactive
On 2013/12/02 20:24:16, abarth wrote: > On 2013/12/02 19:24:11, Chris Dumez (Away) wrote: > > ...
7 years ago (2013-12-02 20:32:45 UTC) #7
esprehn
https://codereview.chromium.org/92083002/diff/1/Source/core/dom/DocumentOrderedMap.cpp File Source/core/dom/DocumentOrderedMap.cpp (right): https://codereview.chromium.org/92083002/diff/1/Source/core/dom/DocumentOrderedMap.cpp#newcode92 Source/core/dom/DocumentOrderedMap.cpp:92: ASSERT(it != m_map.end()); The old code definitely didn't ASSERT ...
7 years ago (2013-12-02 20:38:04 UTC) #8
Inactive
https://codereview.chromium.org/92083002/diff/1/Source/core/dom/DocumentOrderedMap.cpp File Source/core/dom/DocumentOrderedMap.cpp (right): https://codereview.chromium.org/92083002/diff/1/Source/core/dom/DocumentOrderedMap.cpp#newcode92 Source/core/dom/DocumentOrderedMap.cpp:92: ASSERT(it != m_map.end()); On 2013/12/02 20:38:04, esprehn wrote: > ...
7 years ago (2013-12-02 20:47:25 UTC) #9
Inactive
https://codereview.chromium.org/92083002/diff/1/Source/core/dom/DocumentOrderedMap.cpp File Source/core/dom/DocumentOrderedMap.cpp (right): https://codereview.chromium.org/92083002/diff/1/Source/core/dom/DocumentOrderedMap.cpp#newcode92 Source/core/dom/DocumentOrderedMap.cpp:92: ASSERT(it != m_map.end()); On 2013/12/02 20:47:26, Chris Dumez (Away) ...
7 years ago (2013-12-02 21:24:42 UTC) #10
Inactive
https://codereview.chromium.org/92083002/diff/1/Source/core/dom/DocumentOrderedMap.cpp File Source/core/dom/DocumentOrderedMap.cpp (right): https://codereview.chromium.org/92083002/diff/1/Source/core/dom/DocumentOrderedMap.cpp#newcode92 Source/core/dom/DocumentOrderedMap.cpp:92: ASSERT(it != m_map.end()); On 2013/12/02 20:38:04, esprehn wrote: > ...
7 years ago (2013-12-02 21:53:25 UTC) #11
Inactive
esprehn@, could you please take another look when you get a chance?
7 years ago (2013-12-05 15:57:24 UTC) #12
Inactive
On 2013/12/05 15:57:24, Chris Dumez wrote: > esprehn@, could you please take another look when ...
7 years ago (2013-12-10 15:34:28 UTC) #13
Inactive
Could I please get feedback on this patch? Would it help if I split the ...
7 years ago (2013-12-16 15:37:33 UTC) #14
esprehn
Do we know how often pages have multiple ids and do querySelectorAll for them? https://codereview.chromium.org/92083002/diff/40001/Source/core/dom/SelectorQuery.cpp ...
7 years ago (2013-12-17 18:57:47 UTC) #15
Inactive
On 2013/12/17 18:57:47, esprehn wrote: > Do we know how often pages have multiple ids ...
7 years ago (2013-12-17 21:17:24 UTC) #16
Inactive
https://codereview.chromium.org/92083002/diff/40001/Source/core/dom/SelectorQuery.cpp File Source/core/dom/SelectorQuery.cpp (right): https://codereview.chromium.org/92083002/diff/40001/Source/core/dom/SelectorQuery.cpp#newcode461 Source/core/dom/SelectorQuery.cpp:461: if (UNLIKELY(rootNode.treeScope().containsMultipleElementsWithId(idToMatch))) { On 2013/12/17 18:57:48, esprehn wrote: > ...
7 years ago (2013-12-17 21:20:24 UTC) #17
esprehn
lgtm, thanks for doing some research about the numbers! https://codereview.chromium.org/92083002/diff/60001/Source/core/dom/DocumentOrderedMap.cpp File Source/core/dom/DocumentOrderedMap.cpp (right): https://codereview.chromium.org/92083002/diff/60001/Source/core/dom/DocumentOrderedMap.cpp#newcode148 Source/core/dom/DocumentOrderedMap.cpp:148: ...
7 years ago (2013-12-18 00:16:50 UTC) #18
Inactive
https://codereview.chromium.org/92083002/diff/60001/Source/core/dom/DocumentOrderedMap.cpp File Source/core/dom/DocumentOrderedMap.cpp (right): https://codereview.chromium.org/92083002/diff/60001/Source/core/dom/DocumentOrderedMap.cpp#newcode148 Source/core/dom/DocumentOrderedMap.cpp:148: DEFINE_STATIC_LOCAL(Vector<Element*>, emptyVector, ()); On 2013/12/18 00:16:50, esprehn wrote: > ...
7 years ago (2013-12-18 15:25:56 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/92083002/80001
7 years ago (2013-12-18 15:26:39 UTC) #20
commit-bot: I haz the power
7 years ago (2013-12-18 17:27:58 UTC) #21
Message was sent while issue was closed.
Change committed as 164102

Powered by Google App Engine
This is Rietveld 408576698