Use single-threaded hashmap instead of dashmap

Address performance regressions
This commit is contained in:
TechnoPorg committed 2026-01-22 00:30:48 +01:00
1 parent f4160d2387
commit d7806043e1
3 files changed
+9 -29

No files matched your search

Generated
-21
View File
@@ -442,7 +442,6 @@ dependencies = [
"criterion",
"dagrs",
"dagx-macros",
"dashmap",
"futures",
"futures-executor",
"parking_lot",
@@ -462,20 +461,6 @@ dependencies = [
"syn 2.0.106",
]
[[package]]
name = "dashmap"
version = "6.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf"
dependencies = [
"cfg-if",
"crossbeam-utils",
"hashbrown",
"lock_api",
"once_cell",
"parking_lot_core",
]
[[package]]
name = "either"
version = "1.15.0"
@@ -656,12 +641,6 @@ dependencies = [
"crunchy",
]
[[package]]
name = "hashbrown"
version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
[[package]]
name = "hermit-abi"
version = "0.5.2"
-1
View File
@@ -32,7 +32,6 @@ futures = "0.3"
parking_lot = "0.12"
dagx-macros = { version = "0.3.1", path = "./dagx-macros" }
tracing = { version = "0.1", optional = true }
dashmap = "6.1.0"
[dev-dependencies]
tokio = { version = "1", features = [
+9 -7
View File
@@ -13,7 +13,6 @@ use std::sync::{
Arc,
};
use dashmap::DashMap;
use futures::stream::FuturesUnordered;
use futures::{FutureExt, StreamExt, TryFutureExt};
use parking_lot::Mutex;
@@ -314,7 +313,7 @@ impl DagRunner {
let edges = self.edges.lock().clone();
let outputs: DashMap<NodeId, Arc<dyn Any + Send + Sync>> = DashMap::new();
let mut outputs: HashMap<NodeId, Arc<dyn Any + Send + Sync>> = HashMap::new();
let mut first_error = None;
for layer in layers {
@@ -414,7 +413,6 @@ impl DagRunner {
} else {
// Slow path: Multiple tasks require spawning and coordination
// Spawn each task in this layer
let outputs = &outputs;
let mut futures: FuturesUnordered<_> = FuturesUnordered::new();
layer
.into_iter()
@@ -437,8 +435,7 @@ impl DagRunner {
// Spawn the task using the provided spawner
let inner_future = async move {
let result = node.execute_with_deps(dependencies).await?;
outputs.insert(node_id, result);
Ok(())
Ok((node_id, result))
};
Some(
@@ -477,8 +474,13 @@ impl DagRunner {
.for_each(|fut| futures.push(fut));
while let Some(out) = futures.next().await {
if let Err(e) = out {
first_error.get_or_insert(e);
match out {
Ok(output) => {
outputs.insert(output.0, output.1);
}
Err(e) => {
first_error.get_or_insert(e);
}
}
}
}