Bug 74269 - Implement a cache for CSSStyleRule::selectorText()
Summary: Implement a cache for CSSStyleRule::selectorText()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alexander Pavlov (apavlov)
URL:
Keywords:
Depends on:
Blocks: 74004
  Show dependency treegraph
 
Reported: 2011-12-12 00:56 PST by Alexander Pavlov (apavlov)
Modified: 2011-12-12 07:48 PST (History)
2 users (show)

See Also:


Attachments
Patch (4.78 KB, patch)
2011-12-12 02:20 PST, Alexander Pavlov (apavlov)
no flags Details | Formatted Diff | Diff
[PATCH] ChangeLog entry augmented (5.36 KB, patch)
2011-12-12 07:09 PST, Alexander Pavlov (apavlov)
kling: review+
kling: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>