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

Consider using symbols instead of strings for fields #38

Open
KristofferC opened this issue Sep 19, 2018 · 2 comments
Open

Consider using symbols instead of strings for fields #38

KristofferC opened this issue Sep 19, 2018 · 2 comments

Comments

@KristofferC
Copy link
Contributor

Currently, fields are indexed using Strings (haskey(element, "flux")). For cases like this, using Symbols is usually better since Symbols are interned and therefore represented by their pointer. This means comparing symbols is just a pointer comparison and hashing them is faster than for strings. For example, the columns in a DataFrame are indexed using Symbols.

@ahojukka5
Copy link
Member

We have had discussions about this subject a couple of times in Gitter. I think we generally agree it would be better to use symbols. We could still have things like update!(elements, "my data", 1.0) syntax for user-friendliness, and string is converted to a symbol.

@ahojukka5
Copy link
Member

Also, going towards more explicit syntax, maybe it would be good to have update_integration_points!, update_element!, update_problem!, update_analysis! and so on to make clear for which structure are fields going to be updated.

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

No branches or pull requests

2 participants