mirror of
https://github.com/servo/servo.git
synced 2025-09-30 08:39:16 +01:00
Replace Hash Algorithm in HashMap/Set with FxHashMap/Set for simple types (#39166)
FxHash is faster than FnvHash and SipHash for simple types up to at least 64 bytes. The cryptographic guarantees are not needed for any types changed here because they are simple ids. This changes the types in script and net crates. In a future PR we will change the remaining Fnv to be also Fx unless there is a reason to keep them as Fnv. Testing: Should not change functionality but unit test and wpt will find it. Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This commit is contained in:
parent
1deb7b5957
commit
177f6d6502
46 changed files with 226 additions and 215 deletions
|
@ -9,6 +9,7 @@ use dom_struct::dom_struct;
|
|||
use embedder_traits::{
|
||||
MediaMetadata as EmbedderMediaMetadata, MediaSessionActionType, MediaSessionEvent,
|
||||
};
|
||||
use rustc_hash::FxBuildHasher;
|
||||
|
||||
use super::bindings::trace::HashMapTracedValues;
|
||||
use crate::conversions::Convert;
|
||||
|
@ -44,8 +45,9 @@ pub(crate) struct MediaSession {
|
|||
playback_state: DomRefCell<MediaSessionPlaybackState>,
|
||||
/// <https://w3c.github.io/mediasession/#supported-media-session-actions>
|
||||
#[ignore_malloc_size_of = "Rc"]
|
||||
action_handlers:
|
||||
DomRefCell<HashMapTracedValues<MediaSessionActionType, Rc<MediaSessionActionHandler>>>,
|
||||
action_handlers: DomRefCell<
|
||||
HashMapTracedValues<MediaSessionActionType, Rc<MediaSessionActionHandler>, FxBuildHasher>,
|
||||
>,
|
||||
/// The media instance controlled by this media session.
|
||||
/// For now only HTMLMediaElements are controlled by media sessions.
|
||||
media_instance: MutNullableDom<HTMLMediaElement>,
|
||||
|
@ -58,7 +60,7 @@ impl MediaSession {
|
|||
reflector_: Reflector::new(),
|
||||
metadata: DomRefCell::new(None),
|
||||
playback_state: DomRefCell::new(MediaSessionPlaybackState::None),
|
||||
action_handlers: DomRefCell::new(HashMapTracedValues::new()),
|
||||
action_handlers: DomRefCell::new(HashMapTracedValues::new_fx()),
|
||||
media_instance: Default::default(),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue