Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance fixes for the eval apis #1617

Merged
merged 2 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion raphtory/src/algorithms/motifs/triangle_count.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub fn triangle_count<G: StaticGraphViewOps>(graph: &G, threads: Option<usize>)
let step1 = ATask::new(move |s: &mut EvalNodeView<NodeSubgraph<G>, ()>| {
for t in s.neighbours() {
if s.node > t.node {
t.update(&neighbours_set, s.node.node);
t.update(&neighbours_set, s.node);
}
}
Step::Continue
Expand Down
14 changes: 13 additions & 1 deletion raphtory/src/db/task/edge/eval_edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ use crate::{

use crate::db::task::edge::eval_edges::EvalEdges;

use crate::db::api::storage::storage_ops::GraphStorage;
use std::{cell::RefCell, rc::Rc};

pub struct EvalEdgeView<'graph, 'a, G, GH, CS: Clone, S> {
pub(crate) ss: usize,
pub(crate) edge: EdgeView<&'graph G, GH>,
pub(crate) storage: &'graph GraphStorage,
pub(crate) node_state: Rc<RefCell<EVState<'a, CS>>>,
pub(crate) local_state_prev: &'graph PrevLocalState<'a, S>,
}
Expand All @@ -39,12 +41,14 @@ impl<
pub(crate) fn new(
ss: usize,
edge: EdgeView<&'graph G, GH>,
storage: &'graph GraphStorage,
node_state: Rc<RefCell<EVState<'a, CS>>>,
local_state_prev: &'graph PrevLocalState<'a, S>,
) -> Self {
Self {
ss,
edge,
storage,
node_state,
local_state_prev,
}
Expand Down Expand Up @@ -97,9 +101,13 @@ impl<
let ss = self.ss;
let node_state = self.node_state.clone();
let local_state_prev = self.local_state_prev;
let storage = self.storage;
EvalNodeView {
ss,
node,
node: node.node,
graph: node.base_graph,
base_graph: node.base_graph,
storage,
local_state: None,
local_state_prev,
node_state,
Expand All @@ -117,9 +125,11 @@ impl<
let ss = self.ss;
let node_state = self.node_state.clone();
let local_state_prev = self.local_state_prev;
let storage = self.storage;
EvalEdges {
ss,
edges,
storage,
node_state,
local_state_prev,
}
Expand All @@ -139,6 +149,7 @@ impl<
Self {
ss: self.ss,
edge: self.edge.clone(),
storage: self.storage,
node_state: self.node_state.clone(),
local_state_prev: self.local_state_prev,
}
Expand Down Expand Up @@ -174,6 +185,7 @@ impl<
EvalEdgeView::new(
self.ss,
edge,
self.storage,
self.node_state.clone(),
self.local_state_prev,
)
Expand Down
16 changes: 15 additions & 1 deletion raphtory/src/db/task/edge/eval_edges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::{
db::{
api::{
properties::Properties,
storage::storage_ops::GraphStorage,
view::{internal::OneHopFilter, BaseEdgeViewOps, BoxedLIter},
},
graph::edges::Edges,
Expand All @@ -22,6 +23,7 @@ use std::{cell::RefCell, rc::Rc};
pub struct EvalEdges<'graph, 'a, G, GH, CS: Clone, S> {
pub(crate) ss: usize,
pub(crate) edges: Edges<'graph, &'graph G, GH>,
pub(crate) storage: &'graph GraphStorage,
pub(crate) node_state: Rc<RefCell<EVState<'a, CS>>>,
pub(crate) local_state_prev: &'graph PrevLocalState<'a, S>,
}
Expand Down Expand Up @@ -57,9 +59,11 @@ impl<'graph, 'a: 'graph, G: GraphViewOps<'graph>, GH: GraphViewOps<'graph>, CS:
let ss = self.ss;
let node_state = self.node_state.clone();
let local_state_prev = self.local_state_prev;
let storage = self.storage;
EvalEdges {
ss,
edges,
storage,
node_state,
local_state_prev,
}
Expand All @@ -79,9 +83,11 @@ impl<
let node_state = self.node_state.clone();
let ss = self.ss;
let local_state_prev = self.local_state_prev;
let storage = self.storage;
self.edges.iter().map(move |edge| EvalEdgeView {
ss,
edge,
storage,
node_state: node_state.clone(),
local_state_prev,
})
Expand All @@ -104,9 +110,11 @@ impl<
let node_state = self.node_state;
let ss = self.ss;
let local_state_prev = self.local_state_prev;
let storage = self.storage;
Box::new(self.edges.iter().map(move |edge| EvalEdgeView {
ss,
edge,
storage,
node_state: node_state.clone(),
local_state_prev,
}))
Expand Down Expand Up @@ -159,11 +167,15 @@ impl<
let node_state = self.node_state.clone();
let local_state_prev = self.local_state_prev;
let path = self.edges.map_nodes(op);
let base_graph = self.edges.base_graph;
EvalPathFromNode {
path,
graph: base_graph,
base_graph: base_graph,
op: path.op,
ss,
node_state,
local_state_prev,
storage: self.storage,
}
}

Expand All @@ -178,8 +190,10 @@ impl<
let node_state = self.node_state.clone();
let local_state_prev = self.local_state_prev;
let edges = self.edges.map_exploded(op);
let storage = self.storage;
Self {
ss,
storage,
node_state,
local_state_prev,
edges,
Expand Down
Loading
Loading