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:
Narfinger 2025-09-10 15:34:54 +02:00 committed by GitHub
parent 726b456120
commit 84465e7768
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
55 changed files with 211 additions and 202 deletions

View file

@ -6,7 +6,6 @@
use std::borrow::Cow;
use std::cell::{Cell, Ref, RefCell, RefMut};
use std::collections::HashMap;
use std::collections::vec_deque::VecDeque;
use std::rc::Rc;
use std::thread;
@ -226,8 +225,8 @@ pub(crate) struct Tokenizer {
#[ignore_malloc_size_of = "Defined in std"]
#[no_trace]
html_tokenizer_sender: Sender<ToHtmlTokenizerMsg>,
#[ignore_malloc_size_of = "Defined in std"]
nodes: RefCell<HashMap<ParseNodeId, Dom<Node>>>,
//#[ignore_malloc_size_of = "Defined in std"]
nodes: RefCell<FxHashMap<ParseNodeId, Dom<Node>>>,
#[no_trace]
url: ServoUrl,
parsing_algorithm: ParsingAlgorithm,
@ -256,7 +255,7 @@ impl Tokenizer {
document: Dom::from_ref(document),
receiver: tokenizer_receiver,
html_tokenizer_sender: to_html_tokenizer_sender,
nodes: RefCell::new(HashMap::new()),
nodes: RefCell::new(FxHashMap::default()),
url,
parsing_algorithm: algorithm,
custom_element_reaction_stack,