RESOLVED FIXED 88222
Improve the performance of pushScope in StyleResolver
https://bugs.webkit.org/show_bug.cgi?id=88222
Summary Improve the performance of pushScope in StyleResolver
Takashi Sakamoto
Reported 2012-06-04 04:00:22 PDT
As StyleResolver::setupScopeStack has a bug that m_scopeStackParent is always set to be NULL, setupScopeStack is always invoked if scoped author styles exist.
Attachments
Patch (2.90 KB, patch)
2012-06-04 04:24 PDT, Takashi Sakamoto
no flags
Patch (2.76 KB, patch)
2012-06-07 04:29 PDT, Takashi Sakamoto
no flags
Takashi Sakamoto
Comment 1 2012-06-04 04:24:11 PDT
Hajime Morrita
Comment 2 2012-06-04 18:10:40 PDT
Comment on attachment 145558 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=145558&action=review > Source/WebCore/ChangeLog:10 > + Reviewed by NOBODY (OOPS!). The "Reviewed By" line should be jut after the bug URL. See others. > Source/WebCore/css/StyleResolver.cpp:563 > for (; parent; parent = parent->parentOrHostNode()) { It would be better to introduce new local variable for this loop instead of reusing the parameter. It's generally a bad style to reuse it and that is a source of this bug. > Source/WebCore/css/StyleResolver.cpp:597 > + const ScopeStackFrame& lastFrame = m_scopeStack[m_scopeStack.size() - 1]; Vector::last() is preferred. Then it's easy to pack the conditional into the single if clause. Also, why do we need isEmpty() check?
Takashi Sakamoto
Comment 3 2012-06-07 04:29:04 PDT
Takashi Sakamoto
Comment 4 2012-06-07 04:34:57 PDT
(In reply to comment #2) > (From update of attachment 145558 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=145558&action=review > > > Source/WebCore/ChangeLog:10 > > + Reviewed by NOBODY (OOPS!). > > The "Reviewed By" line should be jut after the bug URL. See others. Done. However, I think, this is the default order generated by prepare-ChangeLog script. > > Source/WebCore/css/StyleResolver.cpp:563 > > for (; parent; parent = parent->parentOrHostNode()) { > > It would be better to introduce new local variable for this loop instead of reusing the parameter. > It's generally a bad style to reuse it and that is a source of this bug. I see. Done. > > Source/WebCore/css/StyleResolver.cpp:597 > > + const ScopeStackFrame& lastFrame = m_scopeStack[m_scopeStack.size() - 1]; > > Vector::last() is preferred. Then it's easy to pack the conditional into the single if clause. Done. > Also, why do we need isEmpty() check? Yes, we need. Because pushScope doesn't add any ruleset if a scope doesn't have any rules, but m_scopeStackParent is always updated to avoid ruleset recalculation. And I also tested whether we could remove isEmpty() check or not and obtained many crash logs. Best regards, Takashi Sakamoto
Hajime Morrita
Comment 5 2012-06-07 18:34:01 PDT
Comment on attachment 146251 [details] Patch Okay, let's land this.
WebKit Review Bot
Comment 6 2012-06-07 19:06:32 PDT
Comment on attachment 146251 [details] Patch Clearing flags on attachment: 146251 Committed r119782: <http://trac.webkit.org/changeset/119782>
WebKit Review Bot
Comment 7 2012-06-07 19:06:38 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.