Common selectors consisting of id, class and tag rules only can be resolved much faster using a specialized fast path.
Created attachment 81885 [details] patch Implement a fast path for single and descendant selectors consisting of id, class and tag selectors only. Selectors like this are marked on style selector initialization. When encountered during style matching the are resolved using a fast path. Since selectors like are very common, this speeds up style matching quite a bit (up to 50% on some sites according to Shark).
Attachment 81885 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1 Source/WebCore/css/CSSStyleSelector.cpp:2122: A case label should not be indented, but line up with its switch statement. [whitespace/indent] [4] Total errors found: 1 in 3 files If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 81885 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=81885&action=review > Source/WebCore/css/CSSStyleSelector.cpp:365 > + bool canFastCheckSelector() const { return m_canFastCheckSelector; } > + bool hasMultipartSelector() const { return m_hasMultipartSelector; } > + bool topHTMLSelectorMatchesBasedOnRuleHash() const { return m_topHTMLSelectorMatchesBasedOnRuleHash; } When possible I prefer booleans that read like sentences “rule data <xxx>”. The first and third names here don’t really work that way.
http://trac.webkit.org/changeset/78183