Revert "Use Fx* variants of HashMap and HashSet everywhere in Zed" (#7492)

Reverts zed-industries/zed#7481

This would regress performance because we'd be using the standard
library's hash maps everywhere, so reverting for now.
This commit is contained in:
Antonio Scandurra 2024-02-07 13:16:22 +01:00 committed by GitHub
parent 5c8073d344
commit 55129d4d6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 102 additions and 96 deletions

View file

@ -2,7 +2,7 @@ use crate::{
AbsoluteLength, Bounds, DefiniteLength, Edges, Length, Pixels, Point, Size, Style,
WindowContext,
};
use collections::{HashMap, HashSet};
use collections::{FxHashMap, FxHashSet};
use smallvec::SmallVec;
use std::fmt::Debug;
use taffy::{
@ -17,11 +17,11 @@ type NodeMeasureFn =
pub struct TaffyLayoutEngine {
taffy: Taffy,
styles: HashMap<LayoutId, Style>,
children_to_parents: HashMap<LayoutId, LayoutId>,
absolute_layout_bounds: HashMap<LayoutId, Bounds<Pixels>>,
computed_layouts: HashSet<LayoutId>,
nodes_to_measure: HashMap<LayoutId, NodeMeasureFn>,
styles: FxHashMap<LayoutId, Style>,
children_to_parents: FxHashMap<LayoutId, LayoutId>,
absolute_layout_bounds: FxHashMap<LayoutId, Bounds<Pixels>>,
computed_layouts: FxHashSet<LayoutId>,
nodes_to_measure: FxHashMap<LayoutId, NodeMeasureFn>,
}
static EXPECT_MESSAGE: &str = "we should avoid taffy layout errors by construction if possible";
@ -30,11 +30,11 @@ impl TaffyLayoutEngine {
pub fn new() -> Self {
TaffyLayoutEngine {
taffy: Taffy::new(),
styles: HashMap::default(),
children_to_parents: HashMap::default(),
absolute_layout_bounds: HashMap::default(),
computed_layouts: HashSet::default(),
nodes_to_measure: HashMap::default(),
styles: FxHashMap::default(),
children_to_parents: FxHashMap::default(),
absolute_layout_bounds: FxHashMap::default(),
computed_layouts: FxHashSet::default(),
nodes_to_measure: FxHashMap::default(),
}
}