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

@ -17,6 +17,7 @@ use js::jsapi::JSObject;
use js::rust::MutableHandleValue;
use js::typedarray::Float32Array;
use profile_traits::ipc;
use rustc_hash::FxBuildHasher;
use stylo_atoms::Atom;
use webxr_api::{
self, ApiSpace, ContextId as WebXRContextId, Display, EntityTypes, EnvironmentBlendMode,
@ -103,7 +104,8 @@ pub(crate) struct XRSession {
#[no_trace]
next_hit_test_id: Cell<HitTestId>,
#[ignore_malloc_size_of = "defined in webxr"]
pending_hit_test_promises: DomRefCell<HashMapTracedValues<HitTestId, Rc<Promise>>>,
pending_hit_test_promises:
DomRefCell<HashMapTracedValues<HitTestId, Rc<Promise>, FxBuildHasher>>,
/// Opaque framebuffers need to know the session is "outside of a requestAnimationFrame"
/// <https://immersive-web.github.io/webxr/#opaque-framebuffer>
outside_raf: Cell<bool>,
@ -142,7 +144,7 @@ impl XRSession {
end_promises: DomRefCell::new(vec![]),
ended: Cell::new(false),
next_hit_test_id: Cell::new(HitTestId(0)),
pending_hit_test_promises: DomRefCell::new(HashMapTracedValues::new()),
pending_hit_test_promises: DomRefCell::new(HashMapTracedValues::new_fx()),
outside_raf: Cell::new(true),
input_frames: DomRefCell::new(HashMap::new()),
framerate: Cell::new(0.0),