mirror of
https://github.com/servo/servo.git
synced 2025-09-27 23:30:08 +01:00
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:
parent
726b456120
commit
84465e7768
55 changed files with 211 additions and 202 deletions
|
@ -16,13 +16,13 @@ no-wgl = ["surfman/sm-angle-default"]
|
|||
|
||||
[dependencies]
|
||||
base = { workspace = true }
|
||||
rustc-hash = { workspace = true }
|
||||
bincode = { workspace = true }
|
||||
bitflags = { workspace = true }
|
||||
crossbeam-channel = { workspace = true }
|
||||
dpi = { version = "0.1" }
|
||||
embedder_traits = { workspace = true }
|
||||
euclid = { workspace = true }
|
||||
fnv = { workspace = true }
|
||||
gleam = { workspace = true }
|
||||
glow = { workspace = true }
|
||||
image = { workspace = true }
|
||||
|
|
|
@ -12,8 +12,8 @@ use base::print_tree::PrintTree;
|
|||
use bitflags::bitflags;
|
||||
use embedder_traits::ViewportDetails;
|
||||
use euclid::SideOffsets2D;
|
||||
use fnv::FnvHashMap;
|
||||
use malloc_size_of_derive::MallocSizeOf;
|
||||
use rustc_hash::FxHashMap;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use servo_geometry::FastLayoutTransform;
|
||||
use style::values::specified::Overflow;
|
||||
|
@ -561,7 +561,7 @@ impl ScrollTree {
|
|||
/// for nodes that actually exist in this tree.
|
||||
pub fn set_all_scroll_offsets(
|
||||
&mut self,
|
||||
offsets: &FnvHashMap<ExternalScrollId, LayoutVector2D>,
|
||||
offsets: &FxHashMap<ExternalScrollId, LayoutVector2D>,
|
||||
) {
|
||||
for node in self.nodes.iter_mut() {
|
||||
if let SpatialTreeNodeInfo::Scroll(ref mut scroll_info) = node.info {
|
||||
|
@ -587,7 +587,7 @@ impl ScrollTree {
|
|||
|
||||
/// Collect all of the scroll offsets of the scrolling nodes of this tree into a
|
||||
/// [`HashMap`] which can be applied to another tree.
|
||||
pub fn scroll_offsets(&self) -> FnvHashMap<ExternalScrollId, LayoutVector2D> {
|
||||
pub fn scroll_offsets(&self) -> FxHashMap<ExternalScrollId, LayoutVector2D> {
|
||||
HashMap::from_iter(self.nodes.iter().filter_map(|node| match node.info {
|
||||
SpatialTreeNodeInfo::Scroll(ref scroll_info) => {
|
||||
Some((scroll_info.external_id, scroll_info.offset))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue