Moves to FxHashMap for Allocator, BHM, Canvas, Media, Servo, WebGL and WebGPU (#39202)

This moves more of HashMap/FnvHashMap to FxHashmap. Again we only
changed instances that do not look security related and have small keys.

Additionally, allocator used the fnv feature which did not seem to be
used.

Testing: Unit Tests and WPT should cover this and functionality change
is highly unlikely.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This commit is contained in:
Narfinger 2025-09-08 18:06:03 +02:00 committed by GitHub
parent 228b240635
commit d2c78db981
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 53 additions and 46 deletions

View file

@ -17,6 +17,7 @@ doctest = false
background_hang_monitor_api = { workspace = true }
backtrace = { workspace = true }
base = { workspace = true }
rustc-hash = { workspace = true }
crossbeam-channel = { workspace = true }
ipc-channel = { workspace = true }
libc = { workspace = true }

View file

@ -2,7 +2,7 @@
* 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, VecDeque};
use std::collections::VecDeque;
use std::thread::{self, Builder, JoinHandle};
use std::time::{Duration, Instant};
@ -14,6 +14,7 @@ use background_hang_monitor_api::{
use crossbeam_channel::{Receiver, Sender, after, never, select, unbounded};
use ipc_channel::ipc::{IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER;
use rustc_hash::FxHashMap;
use crate::sampler::{NativeStack, Sampler};
@ -208,8 +209,8 @@ struct MonitoredComponent {
struct Sample(MonitoredComponentId, Instant, NativeStack);
struct BackgroundHangMonitorWorker {
component_names: HashMap<MonitoredComponentId, String>,
monitored_components: HashMap<MonitoredComponentId, MonitoredComponent>,
component_names: FxHashMap<MonitoredComponentId, String>,
monitored_components: FxHashMap<MonitoredComponentId, MonitoredComponent>,
constellation_chan: IpcSender<HangMonitorAlert>,
port: Receiver<(MonitoredComponentId, MonitoredComponentMsg)>,
control_port: Receiver<BackgroundHangMonitorControlMsg>,