mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
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:
parent
a32596131a
commit
297dc33a9f
5 changed files with 112 additions and 42 deletions
|
@ -55,6 +55,7 @@ use servo_atoms::Atom;
|
|||
use servo_url::ServoUrl;
|
||||
use std::fmt;
|
||||
use std::fmt::Debug;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::marker::PhantomData;
|
||||
use std::mem::transmute;
|
||||
use std::sync::Arc;
|
||||
|
@ -475,6 +476,14 @@ impl<'le> PartialEq for ServoLayoutElement<'le> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'le> Hash for ServoLayoutElement<'le> {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
self.element.hash(state);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'le> Eq for ServoLayoutElement<'le> {}
|
||||
|
||||
impl<'le> ServoLayoutElement<'le> {
|
||||
fn from_layout_js(el: LayoutJS<Element>) -> ServoLayoutElement<'le> {
|
||||
ServoLayoutElement {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue