RESOLVED FIXED73421
Reuse cached style fully if the parent inherited styles are equal
https://bugs.webkit.org/show_bug.cgi?id=73421
Summary Reuse cached style fully if the parent inherited styles are equal
Antti Koivisto
Reported 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).
Attachments
patch (13.50 KB, patch)
2011-11-30 04:33 PST, Antti Koivisto
oliver: review+
Antti Koivisto
Comment 1 2011-11-30 04:33:07 PST
Antti Koivisto
Comment 2 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.
Oliver Hunt
Comment 3 2011-11-30 09:15:36 PST
Comment on attachment 117167 [details] patch cq+!!!!!!111!!!1!!!
Darin Adler
Comment 4 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.
Antti Koivisto
Comment 5 2011-11-30 09:26:29 PST
(In reply to comment #3) > (From update of attachment 117167 [details]) > cq+!!!!!!111!!!1!!! Oh no!!!11
Antti Koivisto
Comment 6 2011-11-30 09:26:41 PST
Antti Koivisto
Comment 7 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).
Antti Koivisto
Comment 8 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).
Note You need to log in before you can comment on or make changes to this bug.