mirror of
https://github.com/servo/servo.git
synced 2025-09-30 08:39:16 +01:00
Removed FnvHash and transformed the rest to FxHashmap (#39233)
This should be the final PR for the Hash Function series that is trivial. Of note: I decided to transform `HashMapTracedValues<Atom,..>` to use FxBuildHasher. This is likely not going to improve performance as Atom's already have a unique u32 that is used as the Hash but it safes a few bytes for the RandomState that is normally in the HashMap. Signed-off-by: Narfinger <Narfinger@users.noreply.github.com> Testing: Hash function changes should not change functionality, we slightly decrease the size and unit tests still work. Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This commit is contained in:
parent
726b456120
commit
84465e7768
55 changed files with 211 additions and 202 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
use dom_struct::dom_struct;
|
||||
use js::rust::HandleObject;
|
||||
use rustc_hash::FxBuildHasher;
|
||||
use stylo_atoms::Atom;
|
||||
|
||||
use super::bindings::trace::HashMapTracedValues;
|
||||
|
@ -29,7 +30,7 @@ use crate::script_runtime::CanGc;
|
|||
pub(crate) struct DocumentFragment {
|
||||
node: Node,
|
||||
/// Caches for the getElement methods
|
||||
id_map: DomRefCell<HashMapTracedValues<Atom, Vec<Dom<Element>>>>,
|
||||
id_map: DomRefCell<HashMapTracedValues<Atom, Vec<Dom<Element>>, FxBuildHasher>>,
|
||||
}
|
||||
|
||||
impl DocumentFragment {
|
||||
|
@ -37,7 +38,7 @@ impl DocumentFragment {
|
|||
pub(crate) fn new_inherited(document: &Document) -> DocumentFragment {
|
||||
DocumentFragment {
|
||||
node: Node::new_inherited(document),
|
||||
id_map: DomRefCell::new(HashMapTracedValues::new()),
|
||||
id_map: DomRefCell::new(HashMapTracedValues::new_fx()),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,7 +59,9 @@ impl DocumentFragment {
|
|||
)
|
||||
}
|
||||
|
||||
pub(crate) fn id_map(&self) -> &DomRefCell<HashMapTracedValues<Atom, Vec<Dom<Element>>>> {
|
||||
pub(crate) fn id_map(
|
||||
&self,
|
||||
) -> &DomRefCell<HashMapTracedValues<Atom, Vec<Dom<Element>>, FxBuildHasher>> {
|
||||
&self.id_map
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue