constellation: Use FnvHashMap for hashmaps that use ids as keys (#39106)

FNV is faster for hashing less than 16 bytes of data and the
cryptographic properties of the default HashMap are not needed for the
various ids.

Testing: This does not change functionality.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This commit is contained in:
Narfinger 2025-09-03 20:15:19 +02:00 committed by GitHub
parent 0ae9ee28d5
commit 5c7ea4bdee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 71 additions and 54 deletions

View file

@ -26,6 +26,7 @@ crossbeam-channel = { workspace = true }
devtools_traits = { workspace = true }
embedder_traits = { workspace = true }
euclid = { workspace = true }
fnv = { workspace = true }
ipc-channel = { workspace = true }
keyboard-types = { workspace = true }
malloc_size_of = { workspace = true }

View file

@ -9,7 +9,6 @@
#![deny(missing_docs)]
#![deny(unsafe_code)]
use std::collections::HashMap;
use std::fmt;
use std::sync::Arc;
@ -33,6 +32,7 @@ use embedder_traits::{
MediaSessionActionType, ScriptToEmbedderChan, Theme, ViewportDetails, WebDriverScriptCommand,
};
use euclid::{Rect, Scale, Size2D, UnknownUnit};
use fnv::FnvHashMap;
use ipc_channel::ipc::{IpcReceiver, IpcSender};
use keyboard_types::Modifiers;
use malloc_size_of_derive::MallocSizeOf;
@ -253,7 +253,7 @@ pub enum ScriptThreadMessage {
SetWebGPUPort(IpcReceiver<WebGPUMsg>),
/// The compositor scrolled and is updating the scroll states of the nodes in the given
/// pipeline via the Constellation.
SetScrollStates(PipelineId, HashMap<ExternalScrollId, LayoutVector2D>),
SetScrollStates(PipelineId, FnvHashMap<ExternalScrollId, LayoutVector2D>),
/// Evaluate the given JavaScript and return a result via a corresponding message
/// to the Constellation.
EvaluateJavaScript(PipelineId, JavaScriptEvaluationId, String),