Skip to content

Commit

Permalink
Revert "refactor: use foldhash in critical path (#1723)" (#1725)
Browse files Browse the repository at this point in the history
This reverts commit 16d5a00.
  • Loading branch information
diogomatsubara authored Jan 16, 2025
1 parent a78dac5 commit 4173948
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 26 deletions.
7 changes: 0 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ derive-new = "0.7.0"
tracing-subscriber = { version = "0.3", features = ["json", "env-filter"] }
event-listener = "5.3.1"
flume = "0.11"
foldhash = { version = "0.1.4", default-features = false }
form_urlencoded = "1.2.1"
futures = "0.3.30"
futures-util = { version = "0.3.30", default-features = false } # Default features are disabled due to some crates' requirements
Expand Down
1 change: 0 additions & 1 deletion zenoh/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ ahash = { workspace = true }
async-trait = { workspace = true }
bytes = { workspace = true }
flume = { workspace = true }
foldhash = { workspace = true, features = ["default"] }
futures = { workspace = true }
git-version = { workspace = true }
itertools = { workspace = true }
Expand Down
9 changes: 4 additions & 5 deletions zenoh/src/api/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ use std::{
};

use async_trait::async_trait;
use foldhash::HashMapExt;
#[zenoh_macros::internal]
use ref_cast::ref_cast_custom;
use ref_cast::RefCastCustom;
Expand Down Expand Up @@ -130,8 +129,8 @@ pub(crate) struct SessionState {
pub(crate) expr_id_counter: AtomicExprId, // @TODO: manage rollover and uniqueness
pub(crate) qid_counter: AtomicRequestId,
pub(crate) liveliness_qid_counter: AtomicRequestId,
pub(crate) local_resources: foldhash::HashMap<ExprId, Resource>,
pub(crate) remote_resources: foldhash::HashMap<ExprId, Resource>,
pub(crate) local_resources: HashMap<ExprId, Resource>,
pub(crate) remote_resources: HashMap<ExprId, Resource>,
#[cfg(feature = "unstable")]
pub(crate) remote_subscribers: HashMap<SubscriberId, KeyExpr<'static>>,
pub(crate) publishers: HashMap<Id, PublisherState>,
Expand Down Expand Up @@ -164,8 +163,8 @@ impl SessionState {
expr_id_counter: AtomicExprId::new(1), // Note: start at 1 because 0 is reserved for NO_RESOURCE
qid_counter: AtomicRequestId::new(0),
liveliness_qid_counter: AtomicRequestId::new(0),
local_resources: foldhash::HashMap::new(),
remote_resources: foldhash::HashMap::new(),
local_resources: HashMap::new(),
remote_resources: HashMap::new(),
#[cfg(feature = "unstable")]
remote_subscribers: HashMap::new(),
publishers: HashMap::new(),
Expand Down
9 changes: 4 additions & 5 deletions zenoh/src/net/routing/dispatcher/face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use std::{
time::Duration,
};

use foldhash::HashMapExt;
use tokio_util::sync::CancellationToken;
use zenoh_protocol::{
core::{ExprId, Reliability, WhatAmI, WireExpr, ZenohIdProto},
Expand Down Expand Up @@ -69,8 +68,8 @@ pub struct FaceState {
pub(crate) remote_key_interests: HashMap<InterestId, Option<Arc<Resource>>>,
pub(crate) pending_current_interests:
HashMap<InterestId, (Arc<CurrentInterest>, CancellationToken)>,
pub(crate) local_mappings: foldhash::HashMap<ExprId, Arc<Resource>>,
pub(crate) remote_mappings: foldhash::HashMap<ExprId, Arc<Resource>>,
pub(crate) local_mappings: HashMap<ExprId, Arc<Resource>>,
pub(crate) remote_mappings: HashMap<ExprId, Arc<Resource>>,
pub(crate) next_qid: RequestId,
pub(crate) pending_queries: HashMap<RequestId, (Arc<Query>, CancellationToken)>,
pub(crate) mcast_group: Option<TransportMulticast>,
Expand Down Expand Up @@ -101,8 +100,8 @@ impl FaceState {
local_interests: HashMap::new(),
remote_key_interests: HashMap::new(),
pending_current_interests: HashMap::new(),
local_mappings: foldhash::HashMap::new(),
remote_mappings: foldhash::HashMap::new(),
local_mappings: HashMap::new(),
remote_mappings: HashMap::new(),
next_qid: 0,
pending_queries: HashMap::new(),
mcast_group,
Expand Down
13 changes: 6 additions & 7 deletions zenoh/src/net/routing/dispatcher/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use std::{
sync::{Arc, Weak},
};

use foldhash::HashMapExt;
use zenoh_config::WhatAmI;
use zenoh_protocol::{
core::{key_expr::keyexpr, ExprId, WireExpr},
Expand Down Expand Up @@ -169,9 +168,9 @@ pub struct Resource {
pub(crate) expr: String,
pub(crate) suffix: String,
pub(crate) nonwild_prefix: Option<(Arc<Resource>, String)>,
pub(crate) children: foldhash::HashMap<String, Arc<Resource>>,
pub(crate) children: HashMap<String, Arc<Resource>>,
pub(crate) context: Option<ResourceContext>,
pub(crate) session_ctxs: foldhash::HashMap<usize, Arc<SessionContext>>,
pub(crate) session_ctxs: HashMap<usize, Arc<SessionContext>>,
}

impl PartialEq for Resource {
Expand Down Expand Up @@ -209,9 +208,9 @@ impl Resource {
expr: parent.expr.clone() + suffix,
suffix: String::from(suffix),
nonwild_prefix,
children: foldhash::HashMap::new(),
children: HashMap::new(),
context,
session_ctxs: foldhash::HashMap::new(),
session_ctxs: HashMap::new(),
}
}

Expand Down Expand Up @@ -299,9 +298,9 @@ impl Resource {
expr: String::from(""),
suffix: String::from(""),
nonwild_prefix: None,
children: foldhash::HashMap::new(),
children: HashMap::new(),
context: None,
session_ctxs: foldhash::HashMap::new(),
session_ctxs: HashMap::new(),
})
}

Expand Down

0 comments on commit 4173948

Please sign in to comment.