Skip to content

Commit 6de37a8

Browse files
committed
less memmory copies
1 parent 3b32a21 commit 6de37a8

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/SymbolDFG/SymbolFactorGraphs/SymbolFactorGraphs.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ ne(g::SymbolFactorGraph) = g.ne
4545

4646
vertices(g::SymbolFactorGraph) = keys(g.fadjdict)
4747

48-
inneighbors(g::SymbolFactorGraph, v::Symbol) = copy(badj(g, v))
48+
inneighbors(g::SymbolFactorGraph, v::Symbol) = (badj(g, v))
4949

50-
outneighbors(g::SymbolFactorGraph, v::Symbol) = copy(fadj(g, v))
50+
outneighbors(g::SymbolFactorGraph, v::Symbol) = (fadj(g, v))
5151

52-
neighbors(g::SymbolFactorGraph, v::Symbol) = copy(fadj(g, v))
52+
neighbors(g::SymbolFactorGraph, v::Symbol) = (fadj(g, v))
5353

5454
"""
5555
is_directed(g)

src/SymbolDFG/services/SymbolDFG.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ function getNeighbors(dfg::SymbolDFG, node::DFGNode; ready::Union{Nothing, Int}=
308308
error("Variable/factor with label '$(node.label)' does not exist in the factor graph")
309309
end
310310

311-
neighbors_ll = outneighbors(dfg.g, label)
311+
neighbors_ll = copy(outneighbors(dfg.g, label))
312312
# Additional filtering
313313
ready != nothing && filter!(lbl -> _isready(dfg, lbl, ready), neighbors_ll)
314314
backendset != nothing && filter!(lbl -> _isbackendset(dfg, lbl, backendset), neighbors_ll)
@@ -332,7 +332,7 @@ function getNeighbors(dfg::SymbolDFG, label::Symbol; ready::Union{Nothing, Int}=
332332
error("Variable/factor with label '$(label)' does not exist in the factor graph")
333333
end
334334

335-
neighbors_ll = outneighbors(dfg.g, label)
335+
neighbors_ll = copy(outneighbors(dfg.g, label))
336336
# Additional filtering
337337
ready != nothing && filter!(lbl -> _isready(dfg, lbl, ready), neighbors_ll)
338338
backendset != nothing && filter!(lbl -> _isbackendset(dfg, lbl, backendset), neighbors_ll)

0 commit comments

Comments
 (0)