MetaGraphs.jl
MetaGraphs.jl copied to clipboard
Replace inner metadata Dicts with named tuples
If we add a new property, does it mean we reset the NamedTuple with a new one? NamedTuples are immutable
So every vertex/edge could possibly then have a NamedTuple of different type, right? That could possibly be a problem with Julia having to specialize on every type.
Also NamedTuples are ordered and dictionaries are not, so there also another difference.
Yes it would be ok if you store them as Vector{NamedTuple}
.
Also NamedTuples are ordered and dictionaries are not, so there also another difference.
Not sure this would change much
But if you then have a function
function f(t::NamedTuple) begin
... do something
end
where you pass the named tuple, then I thing the compiler might specialize the code for every different tuple type. I think that could be avoided by using the @nospecialize
macro. But in any case, it would probably be the best then, if the user never has direct access to that named tuple.
I wonder if it would not be better to use some kind of dictionary here, that is specialized on having only a small number of keys.