style: Speed up custom property diffing.

When entering or leaving fullscreen in youtube, we spend most of the
restyle time diffing custom properties, under IndexMap::eq.

Turns out that IndexMap equality is not order-aware, and thus you
actually need to make a hashmap lookup for each entry in the map, which
is unnecessarily inefficient.

Instead, just compare the iterators.

See https://github.com/bluss/indexmap/issues/153.

Differential Revision: https://phabricator.services.mozilla.com/D89434
This commit is contained in:
Emilio Cobos Álvarez 2020-09-08 10:33:03 +00:00
parent cd7619dbf6
commit ad0f63769c
3 changed files with 23 additions and 2 deletions

View file

@ -57,7 +57,7 @@ impl GeckoRestyleDamage {
&mut reset_only,
)
};
if reset_only && old_style.custom_properties() != new_style.custom_properties() {
if reset_only && !old_style.custom_properties_equal(new_style) {
// The Gecko_CalcStyleDifference call only checks the non-custom
// property structs, so we check the custom properties here. Since
// they generate no damage themselves, we can skip this check if we