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

Issue 2610513003: Avoid unnecessary updateActiveStyle comparing shadow styles. (Closed)

Created:
3 years, 11 months ago by rune
Modified:
3 years, 11 months ago
Reviewers:
sashab, esprehn
CC:
darktears, apavlov+blink_chromium.org, blink-reviews, blink-reviews-css, blink-reviews-dom_chromium.org, blink-reviews-style_chromium.org, chromium-reviews, dglazkov+blink, eae+blinkwatch, rwlbuis, sof, webcomponents-bugzilla_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Avoid unnecessary updateActiveStyle comparing shadow styles. Found while checking performance for issue 603621. Style sharing is done during style recalc at which point we know that the active style is up-to-date. Instead of using the API for document.styleSheets, compare active stylesheets in ScopedStyleResolver directly. BUG=603621 Committed: https://crrev.com/f831fc79824c0281cdd4f6a90d7bc92dbadd44b0 Cr-Commit-Position: refs/heads/master@{#441357}

Patch Set 1 #

Patch Set 2 : Added tests. #

Total comments: 7

Patch Set 3 : Fixed review issues. #

Total comments: 4

Patch Set 4 : Added documentation. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+132 lines, -9 lines) Patch
M third_party/WebKit/Source/core/BUILD.gn View 1 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp View 1 2 3 1 chunk +22 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/core/css/resolver/ScopedStyleResolverTest.cpp View 1 2 1 chunk +103 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/shadow/ElementShadow.cpp View 1 2 2 chunks +4 lines, -9 lines 0 comments Download

Messages

Total messages: 33 (15 generated)
rune
ptal
3 years, 11 months ago (2017-01-03 11:50:39 UTC) #8
sof
https://codereview.chromium.org/2610513003/diff/20001/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp File third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp (right): https://codereview.chromium.org/2610513003/diff/20001/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp#newcode304 third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp:304: unsigned secondCount = second ? second->m_authorStyleSheets.size() : 0; Using ...
3 years, 11 months ago (2017-01-03 18:48:34 UTC) #11
rune
https://codereview.chromium.org/2610513003/diff/20001/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h File third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h (right): https://codereview.chromium.org/2610513003/diff/20001/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h#newcode79 third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h:79: CORE_EXPORT static bool hasSameStyles(const ScopedStyleResolver*, On 2017/01/03 18:48:34, sof ...
3 years, 11 months ago (2017-01-03 18:52:31 UTC) #12
rune
On 2017/01/03 18:52:31, rune wrote: > https://codereview.chromium.org/2610513003/diff/20001/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h > File third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h (right): > > https://codereview.chromium.org/2610513003/diff/20001/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h#newcode79 > ...
3 years, 11 months ago (2017-01-03 18:55:29 UTC) #13
sof
https://codereview.chromium.org/2610513003/diff/20001/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h File third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h (right): https://codereview.chromium.org/2610513003/diff/20001/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h#newcode79 third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h:79: CORE_EXPORT static bool hasSameStyles(const ScopedStyleResolver*, On 2017/01/03 18:52:31, rune ...
3 years, 11 months ago (2017-01-03 19:11:17 UTC) #14
rune
https://codereview.chromium.org/2610513003/diff/20001/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h File third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h (right): https://codereview.chromium.org/2610513003/diff/20001/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h#newcode79 third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h:79: CORE_EXPORT static bool hasSameStyles(const ScopedStyleResolver*, On 2017/01/03 19:11:17, sof ...
3 years, 11 months ago (2017-01-03 20:51:32 UTC) #15
rune
https://codereview.chromium.org/2610513003/diff/20001/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp File third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp (right): https://codereview.chromium.org/2610513003/diff/20001/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp#newcode304 third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp:304: unsigned secondCount = second ? second->m_authorStyleSheets.size() : 0; On ...
3 years, 11 months ago (2017-01-03 21:33:01 UTC) #16
sashab
Nice patch overall! :) https://codereview.chromium.org/2610513003/diff/40001/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp File third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp (right): https://codereview.chromium.org/2610513003/diff/40001/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp#newcode308 third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp:308: if (first->m_authorStyleSheets[firstCount]->contents() != I know ...
3 years, 11 months ago (2017-01-03 22:35:20 UTC) #17
rune
https://codereview.chromium.org/2610513003/diff/40001/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp File third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp (right): https://codereview.chromium.org/2610513003/diff/40001/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp#newcode308 third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp:308: if (first->m_authorStyleSheets[firstCount]->contents() != On 2017/01/03 22:35:19, sashab wrote: > ...
3 years, 11 months ago (2017-01-03 23:35:42 UTC) #18
sashab
LGTM excellent tests https://codereview.chromium.org/2610513003/diff/40001/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp File third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp (right): https://codereview.chromium.org/2610513003/diff/40001/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp#newcode308 third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp:308: if (first->m_authorStyleSheets[firstCount]->contents() != On 2017/01/03 at ...
3 years, 11 months ago (2017-01-04 00:39:33 UTC) #19
rune
Added documentation upon request from sof.
3 years, 11 months ago (2017-01-04 09:41:36 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2610513003/60001
3 years, 11 months ago (2017-01-04 09:41:59 UTC) #23
commit-bot: I haz the power
Committed patchset #4 (id:60001)
3 years, 11 months ago (2017-01-04 11:55:22 UTC) #26
commit-bot: I haz the power
Patchset 4 (id:??) landed as https://crrev.com/f831fc79824c0281cdd4f6a90d7bc92dbadd44b0 Cr-Commit-Position: refs/heads/master@{#441357}
3 years, 11 months ago (2017-01-04 11:57:39 UTC) #28
esprehn
The updateActiveStyle() calls should be free though because nothing is dirty? What's the performance issue ...
3 years, 11 months ago (2017-01-04 21:51:55 UTC) #30
rune
On 2017/01/04 21:51:55, esprehn wrote: > The updateActiveStyle() calls should be free though because nothing ...
3 years, 11 months ago (2017-01-05 22:17:46 UTC) #31
esprehn
On 2017/01/05 at 22:17:46, rune wrote: > On 2017/01/04 21:51:55, esprehn wrote: > > The ...
3 years, 11 months ago (2017-01-05 22:48:55 UTC) #32
rune
3 years, 11 months ago (2017-01-05 22:59:24 UTC) #33
Message was sent while issue was closed.
On 2017/01/05 22:48:55, esprehn wrote:
> On 2017/01/05 at 22:17:46, rune wrote:
> > On 2017/01/04 21:51:55, esprehn wrote:
> > > The updateActiveStyle() calls should be free though because nothing is
> dirty?
> > > What's the performance issue here?
> > 
> > This is callgrind output for styleForElement running the 603621 test case
> before and after the fix: http://imgur.com/gallery/RqVsN
> > 
> > updateActiveStyle() looks like this and is not inline:
> > 
> > void StyleEngine::updateActiveStyle() {
> >   DCHECK(document().isActive());
> >   updateViewport();
> >   updateActiveStyleSheets();
> >   updateGlobalRuleSet();
> > }
> > 
> > The _before_ image is missing updateActiveStyle(), but a lot of time is
> actually spent on hashtable lookups in styleSheetsForStyleSheetList().
> > 
> > Another reason why this change makes sense is that the active stylesheets
are
> more correct than the stylesheet list, since sheets not matching media queries
> would still be part of the styleSheetsForStyleSheetList.
> 
> Interesting, I see dirty bit checks at the start of all three of those
function
> calls, perhaps we should have a global dirty bit check at the start of
> updateActiveStyle() and make it inline.

Yes.

Powered by Google App Engine
This is Rietveld 408576698