Bug 73421 - Reuse cached style fully if the parent inherited styles are equal
Summary: Reuse cached style fully if the parent inherited styles are equal
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-30 03:06 PST by Antti Koivisto
Modified: 2011-11-30 09:33 PST (History)
4 users (show)

See Also:


Attachments
patch (13.50 KB, patch)
2011-11-30 04:33 PST, Antti Koivisto
oliver: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antti Koivisto 2011-11-30 03:06:39 PST
Matched declaration cache currently restores the non-inherted properties from the cache entry but still applies all inherited properties normally. In case the current parent inherited style is equivalent to the cache entry's, also the inherited style can be reused and no properties need to be applied. This is faster and saves memory (by sharing the style structures more).
Comment 1 Antti Koivisto 2011-11-30 04:33:07 PST
Created attachment 117167 [details]
patch
Comment 2 Antti Koivisto 2011-11-30 05:56:35 PST
Loading the HTML5 spec this reduces style memory consumption by ~20% (5MB, ~2.5% of the total) and speeds up the style applying by ~25% for ~0.4s (2-3%) gain in the benchmark.
Comment 3 Oliver Hunt 2011-11-30 09:15:36 PST
Comment on attachment 117167 [details]
patch

cq+!!!!!!111!!!1!!!
Comment 4 Darin Adler 2011-11-30 09:23:45 PST
Comment on attachment 117167 [details]
patch

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

> Source/WebCore/rendering/style/RenderStyle.cpp:332
> +        && inherited.get() == other->inherited.get()
> +#if ENABLE(SVG)
> +        && m_svgStyle.get() == other->m_svgStyle.get()
> +#endif
> +        && rareInheritedData.get() == other->rareInheritedData.get();

I’m surprised these get() calls were needed. You typically can compare smart pointers without an explicit get() call.
Comment 5 Antti Koivisto 2011-11-30 09:26:29 PST
(In reply to comment #3)
> (From update of attachment 117167 [details])
> cq+!!!!!!111!!!1!!!

Oh no!!!11
Comment 6 Antti Koivisto 2011-11-30 09:26:41 PST
http://trac.webkit.org/changeset/101524
Comment 7 Antti Koivisto 2011-11-30 09:28:13 PST
> I’m surprised these get() calls were needed. You typically can compare smart pointers without an explicit get() call.

These smart pointers are bit special (some very early khtml code too).
Comment 8 Antti Koivisto 2011-11-30 09:33:42 PST
Specifically DataRef::operator== compares the objects for equality rather than just the pointers (which is what I want here for performance reasons).