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

@ -2,14 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use std::collections::HashMap;
use app_units::Au;
use base::id::ScrollTreeNodeId;
use embedder_traits::Cursor;
use euclid::{Box2D, Vector2D};
use kurbo::{Ellipse, Shape};
use layout_api::{ElementsFromPointFlags, ElementsFromPointResult};
use rustc_hash::FxHashMap;
use servo_geometry::FastLayoutTransform;
use style::computed_values::backface_visibility::T as BackfaceVisibility;
use style::computed_values::pointer_events::T as PointerEvents;
@ -40,7 +39,7 @@ pub(crate) struct HitTest<'a> {
/// The resulting [`HitTestResultItems`] for this hit test.
results: Vec<ElementsFromPointResult>,
/// A cache of hit test results for shared clip nodes.
clip_hit_test_results: HashMap<ClipId, bool>,
clip_hit_test_results: FxHashMap<ClipId, bool>,
}
impl<'a> HitTest<'a> {
@ -55,7 +54,7 @@ impl<'a> HitTest<'a> {
projected_point_to_test: None,
stacking_context_tree,
results: Vec::new(),
clip_hit_test_results: HashMap::new(),
clip_hit_test_results: FxHashMap::default(),
};
stacking_context_tree
.root_stacking_context