Store slow selector flags in a hashmap.

This reduces the flag setting overhead on a pessimal testcase from over a
second to ~20ms.
This commit is contained in:
Bobby Holley 2017-04-13 15:42:51 +08:00
parent a32596131a
commit 297dc33a9f
5 changed files with 112 additions and 42 deletions

View file

@ -67,6 +67,7 @@ use shared_lock::Locked;
use sink::Push;
use std::cell::RefCell;
use std::fmt;
use std::hash::{Hash, Hasher};
use std::ptr;
use std::sync::Arc;
use string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
@ -705,6 +706,14 @@ impl<'le> PartialEq for GeckoElement<'le> {
}
}
impl<'le> Eq for GeckoElement<'le> {}
impl<'le> Hash for GeckoElement<'le> {
fn hash<H: Hasher>(&self, state: &mut H) {
(self.0 as *const _).hash(state);
}
}
impl<'le> PresentationalHintsSynthetizer for GeckoElement<'le> {
fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, hints: &mut V)
where V: Push<ApplicableDeclarationBlock>,