Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Replace inner metadata Dicts with named tuples #46

Open
sbromberger opened this issue Aug 21, 2018 · 4 comments
Open

Replace inner metadata Dicts with named tuples #46

sbromberger opened this issue Aug 21, 2018 · 4 comments

Comments

@sbromberger
Copy link
Owner

No description provided.

@matbesancon
Copy link
Contributor

If we add a new property, does it mean we reset the NamedTuple with a new one? NamedTuples are immutable

@simonschoelly
Copy link
Contributor

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.

@matbesancon
Copy link
Contributor

matbesancon commented May 19, 2019

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

@simonschoelly
Copy link
Contributor

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants