diff options
author | Emilio Cobos Álvarez <ecoal95@gmail.com> | 2016-07-29 17:24:12 -0700 |
---|---|---|
committer | Emilio Cobos Álvarez <ecoal95@gmail.com> | 2016-08-17 14:16:16 -0700 |
commit | 3af774bd7535df061a5f89448b57fd9bdb9ef71c (patch) | |
tree | 25c9bc38c36100e95eb5e2c2443cdd4e19ab19b8 /components/script/layout_wrapper.rs | |
parent | ec53136863f20b80caf165d2f15e8a77d614536e (diff) | |
download | servo-3af774bd7535df061a5f89448b57fd9bdb9ef71c.tar.gz servo-3af774bd7535df061a5f89448b57fd9bdb9ef71c.zip |
Rewrite the style sharing candidate cache.
The style candidate cache had regressed a few times (see #12534), and my
intuition is that being able to disable all style sharing with a single rule in
the page is really unfortunate.
This commit redesigns the style sharing cache in order to be a optimistic cache,
but then reject candidates if they match different sibling-affecting selectors
in the page, for example.
So far the numbers have improved, but not so much as I'd wanted (~10%/20% of
non-incremental restyling time in general). The current implementation is really
dumb though (we recompute and re-match a lot of stuff), so we should be able to
optimise it quite a bit.
I have different ideas for improving it (that may or may not work), apart of the
low-hanging fruit like don't re-matching candidates all the time but I have to
measure the real impact.
Also, I need to verify it against try.
Diffstat (limited to 'components/script/layout_wrapper.rs')
-rw-r--r-- | components/script/layout_wrapper.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/components/script/layout_wrapper.rs b/components/script/layout_wrapper.rs index 7668c9ff272..13fcdc41df9 100644 --- a/components/script/layout_wrapper.rs +++ b/components/script/layout_wrapper.rs @@ -444,6 +444,11 @@ impl<'le> TElement for ServoLayoutElement<'le> { } } +impl<'le> PartialEq for ServoLayoutElement<'le> { + fn eq(&self, other: &Self) -> bool { + self.as_node() == other.as_node() + } +} impl<'le> ServoLayoutElement<'le> { fn from_layout_js(el: LayoutJS<Element>) -> ServoLayoutElement<'le> { |