replace fxhash crate with rustc-hash (#588)

This commit is contained in:
saicu authored and GitHub committed 2022-10-12 18:27:26 -07:00
1 parent 23c48cf795
commit e8c48d46cf
18 files changed
+22 -22

No files matched your search

+1 -1
View File
@@ -18,7 +18,7 @@ keywords = ["dom", "ui", "gui", "react", "wasm"]
bumpalo = { version = "3.6", features = ["collections", "boxed"] } bumpalo = { version = "3.6", features = ["collections", "boxed"] }
# faster hashmaps # faster hashmaps
fxhash = "0.2" rustc-hash = "1.1.0"
# Used in diffing # Used in diffing
longest-increasing-subsequence = "0.1.0" longest-increasing-subsequence = "0.1.0"
+2 -2
View File
@@ -104,7 +104,7 @@ use crate::{
Attribute, TemplateAttributeValue, Attribute, TemplateAttributeValue,
}; };
use bumpalo::Bump; use bumpalo::Bump;
use fxhash::{FxHashMap, FxHashSet}; use rustc_hash::{FxHashMap, FxHashSet};
use smallvec::{smallvec, SmallVec}; use smallvec::{smallvec, SmallVec};
pub(crate) struct DiffState<'bump> { pub(crate) struct DiffState<'bump> {
@@ -886,7 +886,7 @@ impl<'b> DiffState<'b> {
// The stack is empty upon entry. // The stack is empty upon entry.
fn diff_keyed_children(&mut self, old: &'b [VNode<'b>], new: &'b [VNode<'b>]) { fn diff_keyed_children(&mut self, old: &'b [VNode<'b>], new: &'b [VNode<'b>]) {
if cfg!(debug_assertions) { if cfg!(debug_assertions) {
let mut keys = fxhash::FxHashSet::default(); let mut keys = rustc_hash::FxHashSet::default();
let mut assert_unique_keys = |children: &'b [VNode<'b>]| { let mut assert_unique_keys = |children: &'b [VNode<'b>]| {
keys.clear(); keys.clear();
for child in children { for child in children {
+1 -1
View File
@@ -276,7 +276,7 @@ pub enum DomEdit<'bump> {
}, },
} }
use fxhash::FxHashSet; use rustc_hash::FxHashSet;
use DomEdit::*; use DomEdit::*;
impl<'a> Mutations<'a> { impl<'a> Mutations<'a> {
+1 -1
View File
@@ -9,7 +9,7 @@ use crate::{
}; };
use bumpalo::Bump; use bumpalo::Bump;
use futures_channel::mpsc::UnboundedSender; use futures_channel::mpsc::UnboundedSender;
use fxhash::FxHashMap; use rustc_hash::FxHashMap;
use slab::Slab; use slab::Slab;
use std::{ use std::{
any::{Any, TypeId}, any::{Any, TypeId},
+1 -1
View File
@@ -60,7 +60,7 @@
/// The maxiumum integer in JS /// The maxiumum integer in JS
pub const JS_MAX_INT: u64 = 9007199254740991; pub const JS_MAX_INT: u64 = 9007199254740991;
use fxhash::FxHashMap; use rustc_hash::FxHashMap;
use std::{cell::Cell, hash::Hash, marker::PhantomData, ops::Index}; use std::{cell::Cell, hash::Hash, marker::PhantomData, ops::Index};
use bumpalo::Bump; use bumpalo::Bump;
+1 -1
View File
@@ -90,8 +90,8 @@ impl<'a> Iterator for ElementIdIterator<'a> {
mod leaky { mod leaky {
use std::sync::Mutex; use std::sync::Mutex;
use fxhash::FxHashSet;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use rustc_hash::FxHashSet;
static STATIC_CACHE: Lazy<Mutex<FxHashSet<&'static str>>> = static STATIC_CACHE: Lazy<Mutex<FxHashSet<&'static str>>> =
Lazy::new(|| Mutex::new(FxHashSet::default())); Lazy::new(|| Mutex::new(FxHashSet::default()));
+1 -1
View File
@@ -6,8 +6,8 @@ use crate::diff::DiffState;
use crate::innerlude::*; use crate::innerlude::*;
use futures_channel::mpsc::{UnboundedReceiver, UnboundedSender}; use futures_channel::mpsc::{UnboundedReceiver, UnboundedSender};
use futures_util::{future::poll_fn, StreamExt}; use futures_util::{future::poll_fn, StreamExt};
use fxhash::FxHashSet;
use indexmap::IndexSet; use indexmap::IndexSet;
use rustc_hash::FxHashSet;
use std::{collections::VecDeque, iter::FromIterator, task::Poll}; use std::{collections::VecDeque, iter::FromIterator, task::Poll};
/// A virtual node system that progresses user events and diffs UI trees. /// A virtual node system that progresses user events and diffs UI trees.
+1 -1
View File
@@ -23,5 +23,5 @@ dioxus-native-core = { path = "../native-core", version = "^0.2.0" }
dioxus = { path = "../dioxus" } dioxus = { path = "../dioxus" }
smallvec = "1.6" smallvec = "1.6"
fxhash = "0.2" rustc-hash = "1.1.0"
anymap = "0.12.1" anymap = "0.12.1"
+3 -3
View File
@@ -169,7 +169,7 @@ fn impl_derive_macro(ast: &syn::DeriveInput) -> TokenStream {
state_tree: &'a mut T, state_tree: &'a mut T,
rdom: &'a T2, rdom: &'a T2,
ctx: &anymap::AnyMap, ctx: &anymap::AnyMap,
) -> fxhash::FxHashSet<dioxus_core::GlobalNodeId>{ ) -> rustc_hash::FxHashSet<dioxus_core::GlobalNodeId>{
#[derive(Eq, PartialEq)] #[derive(Eq, PartialEq)]
struct HeightOrdering { struct HeightOrdering {
height: u16, height: u16,
@@ -236,9 +236,9 @@ fn impl_derive_macro(ast: &syn::DeriveInput) -> TokenStream {
} }
} }
let mut dirty_elements = fxhash::FxHashSet::default(); let mut dirty_elements = rustc_hash::FxHashSet::default();
// the states of any elements that are dirty // the states of any elements that are dirty
let mut states: fxhash::FxHashMap<dioxus_core::GlobalNodeId, MembersDirty> = fxhash::FxHashMap::default(); let mut states: rustc_hash::FxHashMap<dioxus_core::GlobalNodeId, MembersDirty> = rustc_hash::FxHashMap::default();
for (id, mask) in dirty { for (id, mask) in dirty {
let members_dirty = MembersDirty { let members_dirty = MembersDirty {
@@ -318,7 +318,7 @@ fn state_reduce_parent_called_minimally_on_update() {
value: AttributeValue::Text("99%"), value: AttributeValue::Text("99%"),
ns: Some("style"), ns: Some("style"),
}], }],
dirty_scopes: fxhash::FxHashSet::default(), dirty_scopes: rustc_hash::FxHashSet::default(),
refs: Vec::new(), refs: Vec::new(),
}]); }]);
let _to_rerender = dom.update_state(nodes_updated, AnyMap::new()); let _to_rerender = dom.update_state(nodes_updated, AnyMap::new());
@@ -387,7 +387,7 @@ fn state_reduce_child_called_minimally_on_update() {
value: AttributeValue::Text("99%"), value: AttributeValue::Text("99%"),
ns: Some("style"), ns: Some("style"),
}], }],
dirty_scopes: fxhash::FxHashSet::default(), dirty_scopes: rustc_hash::FxHashSet::default(),
refs: Vec::new(), refs: Vec::new(),
}]); }]);
let _to_rerender = dom.update_state(nodes_updated, AnyMap::new()); let _to_rerender = dom.update_state(nodes_updated, AnyMap::new());
+1 -1
View File
@@ -17,7 +17,7 @@ dioxus-core-macro = { path = "../core-macro", version = "^0.2.1" }
taffy = "0.1.0" taffy = "0.1.0"
smallvec = "1.6" smallvec = "1.6"
fxhash = "0.2" rustc-hash = "1.1.0"
anymap = "0.12.1" anymap = "0.12.1"
[dev-dependencies] [dev-dependencies]
+1 -1
View File
@@ -1,5 +1,5 @@
use anymap::AnyMap; use anymap::AnyMap;
use fxhash::{FxHashMap, FxHashSet}; use rustc_hash::{FxHashMap, FxHashSet};
use std::ops::{Index, IndexMut}; use std::ops::{Index, IndexMut};
use dioxus_core::{ use dioxus_core::{
+1 -1
View File
@@ -2,7 +2,7 @@ use std::{cmp::Ordering, fmt::Debug};
use anymap::AnyMap; use anymap::AnyMap;
use dioxus_core::GlobalNodeId; use dioxus_core::GlobalNodeId;
use fxhash::FxHashSet; use rustc_hash::FxHashSet;
use crate::node_ref::{NodeMask, NodeView}; use crate::node_ref::{NodeMask, NodeView};
use crate::real_dom::NodeData; use crate::real_dom::NodeData;
+1 -1
View File
@@ -25,7 +25,7 @@ tokio = { version = "1.15.0", features = ["full"] }
futures = "0.3.19" futures = "0.3.19"
taffy = "0.1.0" taffy = "0.1.0"
smallvec = "1.6" smallvec = "1.6"
fxhash = "0.2" rustc-hash = "1.1.0"
anymap = "0.12.1" anymap = "0.12.1"
[dev-dependencies] [dev-dependencies]
+1 -1
View File
@@ -2,7 +2,7 @@ use crossterm::event::{
Event as TermEvent, KeyCode as TermKeyCode, KeyModifiers, MouseButton, MouseEventKind, Event as TermEvent, KeyCode as TermKeyCode, KeyModifiers, MouseButton, MouseEventKind,
}; };
use dioxus_core::*; use dioxus_core::*;
use fxhash::{FxHashMap, FxHashSet}; use rustc_hash::{FxHashMap, FxHashSet};
use dioxus_html::geometry::euclid::{Point2D, Rect, Size2D}; use dioxus_html::geometry::euclid::{Point2D, Rect, Size2D};
use dioxus_html::geometry::{ use dioxus_html::geometry::{
+1 -1
View File
@@ -133,7 +133,7 @@ fn render_vdom(
terminal.clear().unwrap(); terminal.clear().unwrap();
} }
let mut to_rerender: fxhash::FxHashSet<GlobalNodeId> = let mut to_rerender: rustc_hash::FxHashSet<GlobalNodeId> =
vec![GlobalNodeId::VNodeId(ElementId(0))] vec![GlobalNodeId::VNodeId(ElementId(0))]
.into_iter() .into_iter()
.collect(); .collect();
+1 -1
View File
@@ -21,7 +21,7 @@ js-sys = "0.3.56"
wasm-bindgen = { version = "0.2.79", features = ["enable-interning"] } wasm-bindgen = { version = "0.2.79", features = ["enable-interning"] }
wasm-bindgen-futures = "0.4.29" wasm-bindgen-futures = "0.4.29"
log = { version = "0.4.14" } log = { version = "0.4.14" }
fxhash = "0.2.1" rustc-hash = "1.1.0"
console_error_panic_hook = { version = "0.1.7", optional = true } console_error_panic_hook = { version = "0.1.7", optional = true }
once_cell = "1.9.0" once_cell = "1.9.0"
anyhow = "1.0.53" anyhow = "1.0.53"
+1 -1
View File
@@ -8,7 +8,7 @@
//! - Partial delegation?> //! - Partial delegation?>
use dioxus_core::{DomEdit, ElementId, SchedulerMsg, ScopeId, UserEvent}; use dioxus_core::{DomEdit, ElementId, SchedulerMsg, ScopeId, UserEvent};
use fxhash::FxHashMap; use rustc_hash::FxHashMap;
use std::{any::Any, fmt::Debug, rc::Rc, sync::Arc}; use std::{any::Any, fmt::Debug, rc::Rc, sync::Arc};
use wasm_bindgen::{closure::Closure, JsCast}; use wasm_bindgen::{closure::Closure, JsCast};
use web_sys::{ use web_sys::{