Skip to content

Commit

Permalink
Better performance in RxInfer
Browse files Browse the repository at this point in the history
  • Loading branch information
bvdmitri committed Feb 27, 2024
1 parent 3adbefd commit 74fea7d
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions src/graph_engine.jl
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,10 @@ struct Context
submodel_counts::Dict{Any, Int}
children::Dict{FactorID, Context}
factor_nodes::Dict{FactorID, NodeLabel}
individual_variables::ArrayDictionary{Symbol, NodeLabel}
vector_variables::ArrayDictionary{Symbol, ResizableArray{NodeLabel, Vector{NodeLabel}, 1}}
tensor_variables::ArrayDictionary{Symbol, ResizableArray{NodeLabel}}
proxies::ArrayDictionary{Symbol, ProxyLabel}
individual_variables::UnorderedDictionary{Symbol, NodeLabel}
vector_variables::UnorderedDictionary{Symbol, ResizableArray{NodeLabel, Vector{NodeLabel}, 1}}
tensor_variables::UnorderedDictionary{Symbol, ResizableArray{NodeLabel}}
proxies::UnorderedDictionary{Symbol, ProxyLabel}
end

function Context(depth::Int, fform::Function, prefix::String, parent)
Expand All @@ -234,10 +234,10 @@ function Context(depth::Int, fform::Function, prefix::String, parent)
Dict{Any, Int}(),
Dict{FactorID, Context}(),
Dict{FactorID, NodeLabel}(),
ArrayDictionary{Symbol, NodeLabel}(),
ArrayDictionary{Symbol, ResizableArray{NodeLabel, Vector{NodeLabel}, 1}}(),
ArrayDictionary{Symbol, ResizableArray{NodeLabel}}(),
ArrayDictionary{Symbol, ProxyLabel}()
UnorderedDictionary{Symbol, NodeLabel}(),
UnorderedDictionary{Symbol, ResizableArray{NodeLabel, Vector{NodeLabel}, 1}}(),
UnorderedDictionary{Symbol, ResizableArray{NodeLabel}}(),
UnorderedDictionary{Symbol, ProxyLabel}()
)
end

Expand Down Expand Up @@ -496,10 +496,10 @@ The `plugins` field stores additional properties of the node depending on which
struct NodeData
context :: Context
properties :: Union{VariableNodeProperties, FactorNodeProperties}
extra :: ArrayDictionary{Symbol, Any}
extra :: UnorderedDictionary{Symbol, Any}
end

NodeData(context, properties) = NodeData(context, properties, ArrayDictionary{Symbol, Any}())
NodeData(context, properties) = NodeData(context, properties, UnorderedDictionary{Symbol, Any}())

function Base.show(io::IO, nodedata::NodeData)
context = getcontext(nodedata)
Expand Down Expand Up @@ -753,9 +753,7 @@ function create_model(; fform = identity, plugins = PluginsCollection())
label_type = NodeLabel
edge_data_type = EdgeLabel
vertex_data_type = NodeData
graph = MetaGraph(
Graph(), label_type = label_type, vertex_data_type = vertex_data_type, edge_data_type = edge_data_type, graph_data = Context(fform)
)
graph = MetaGraph(Graph(), label_type, vertex_data_type, edge_data_type, Context(fform))
model = Model(graph, plugins)
return model
end
Expand Down

0 comments on commit 74fea7d

Please sign in to comment.