Bug 74269

Summary: Implement a cache for CSSStyleRule::selectorText()
Product: WebKit Reporter: Alexander Pavlov (apavlov) <apavlov>
Component: CSSAssignee: Alexander Pavlov (apavlov) <apavlov>
Status: RESOLVED FIXED    
Severity: Normal CC: macpherson, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 74004    
Attachments:
Description Flags
Patch
none
[PATCH] ChangeLog entry augmented kling: review+, kling: commit-queue-

Description Alexander Pavlov (apavlov) 2011-12-12 00:56:58 PST
Patch to follow.
Comment 1 Alexander Pavlov (apavlov) 2011-12-12 02:20:42 PST
Created attachment 118754 [details]
Patch
Comment 2 Alexander Pavlov (apavlov) 2011-12-12 07:09:44 PST
Created attachment 118782 [details]
[PATCH] ChangeLog entry augmented
Comment 3 Andreas Kling 2011-12-12 07:21:07 PST
Comment on attachment 118782 [details]
[PATCH] ChangeLog entry augmented

View in context: https://bugs.webkit.org/attachment.cgi?id=118782&action=review

r=me, but please inline cleanup() before landing.

> Source/WebCore/css/CSSStyleRule.cpp:51
> +    cleanup();

I'd rather we inline cleanup() here to avoid introducing a perf regression (however tiny) in document teardown.

> Source/WebCore/css/CSSStyleRule.cpp:126
> +    if (m_hasCachedSelectorText) {
> +        ASSERT(selectorTextCache().contains(this));
> +        selectorTextCache().remove(this);
> +        m_hasCachedSelectorText = false;
> +    }
> +
>      if (this->selectorText() == oldSelectorText)
>          return;

We could factor this differently to reduce hash map churn (the remove() is always followed by a set().)
Comment 4 Alexander Pavlov (apavlov) 2011-12-12 07:48:00 PST
Committed r102584: <http://trac.webkit.org/changeset/102584>