mirror of
https://github.com/servo/servo.git
synced 2025-09-29 16:19:14 +01:00
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:
parent
0ae9ee28d5
commit
5c7ea4bdee
19 changed files with 71 additions and 54 deletions
|
@ -23,6 +23,7 @@ devtools_traits = { workspace = true }
|
|||
embedder_traits = { workspace = true }
|
||||
euclid = { workspace = true }
|
||||
fonts_traits = { workspace = true }
|
||||
fnv = { workspace = true }
|
||||
http = { workspace = true }
|
||||
hyper_serde = { workspace = true }
|
||||
ipc-channel = { workspace = true }
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
//! Messages send from the ScriptThread to the Constellation.
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::fmt;
|
||||
|
||||
use base::Epoch;
|
||||
|
@ -22,6 +21,7 @@ use embedder_traits::{
|
|||
ViewportDetails, WebDriverMessageId,
|
||||
};
|
||||
use euclid::default::Size2D as UntypedSize2D;
|
||||
use fnv::FnvHashMap;
|
||||
use fonts_traits::SystemFontServiceProxySender;
|
||||
use http::{HeaderMap, Method};
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
|
@ -492,7 +492,7 @@ pub enum ScriptToConstellationMessage {
|
|||
/* The ids of ports transferred successfully */
|
||||
Vec<MessagePortId>,
|
||||
/* The ids, and buffers, of ports whose transfer failed */
|
||||
HashMap<MessagePortId, PortTransferInfo>,
|
||||
FnvHashMap<MessagePortId, PortTransferInfo>,
|
||||
),
|
||||
/// A new message-port was created or transferred, with corresponding control-sender.
|
||||
NewMessagePort(MessagePortRouterId, MessagePortId),
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
mod from_script_message;
|
||||
mod structured_data;
|
||||
|
||||
use std::collections::{HashMap, VecDeque};
|
||||
use std::collections::VecDeque;
|
||||
use std::fmt;
|
||||
use std::time::Duration;
|
||||
|
||||
|
@ -22,6 +22,7 @@ use embedder_traits::{
|
|||
CompositorHitTestResult, FocusId, InputEvent, JavaScriptEvaluationId, MediaSessionActionType,
|
||||
Theme, TraversalId, ViewportDetails, WebDriverCommandMsg, WebDriverCommandResponse,
|
||||
};
|
||||
use fnv::FnvHashMap;
|
||||
pub use from_script_message::*;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use malloc_size_of_derive::MallocSizeOf;
|
||||
|
@ -41,7 +42,7 @@ pub enum EmbedderToConstellationMessage {
|
|||
/// Exit the constellation.
|
||||
Exit,
|
||||
/// Query the constellation to see if the current compositor output is stable
|
||||
IsReadyToSaveImage(HashMap<PipelineId, Epoch>),
|
||||
IsReadyToSaveImage(FnvHashMap<PipelineId, Epoch>),
|
||||
/// Whether to allow script to navigate.
|
||||
AllowNavigationResponse(PipelineId, bool),
|
||||
/// Request to load a page.
|
||||
|
@ -94,7 +95,7 @@ pub enum EmbedderToConstellationMessage {
|
|||
SetWebViewThrottled(WebViewId, bool),
|
||||
/// The Servo renderer 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>),
|
||||
/// Notify the constellation that a particular paint metric event has happened for the given pipeline.
|
||||
PaintMetric(PipelineId, PaintMetricEvent),
|
||||
/// Evaluate a JavaScript string in the context of a `WebView`. When execution is complete or an
|
||||
|
@ -180,7 +181,7 @@ pub struct PortTransferInfo {
|
|||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum MessagePortMsg {
|
||||
/// Complete the transfer for a batch of ports.
|
||||
CompleteTransfer(HashMap<MessagePortId, PortTransferInfo>),
|
||||
CompleteTransfer(FnvHashMap<MessagePortId, PortTransferInfo>),
|
||||
/// Complete the transfer of a single port,
|
||||
/// whose transfer was pending because it had been requested
|
||||
/// while a previous failed transfer was being rolled-back.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue