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

Using NamedTuple instead of dictionaries #20

Open
AntonOresten opened this issue Sep 4, 2024 · 1 comment
Open

Using NamedTuple instead of dictionaries #20

AntonOresten opened this issue Sep 4, 2024 · 1 comment

Comments

@AntonOresten
Copy link
Owner

It might be worth looking into whether setting properties in a NamedTuples can match the speed of dynamic dictionaries. Important note is that NamedTuple, like tuples, are immutable, and the tuple of properties would thus need to be instantiated for each modification, but maybe a package like Setfield.jl would make it easy (and fast?) to modify dynamic properties. My hope is that using NamedTuples would be more type-stable and lead to better performance (See #8). Since the property types of NamedTuples are embedded into the instance type, I guess the field would need to be a generic NamedTuple, which might undermine the potential benefits.

@Tortar
Copy link
Collaborator

Tortar commented Sep 6, 2024

I guess the field would need to be a generic NamedTuple, which might undermine the potential benefits.

I tested this strategy some time ago, and indeed, this seems to be the case, but if you want to double-verify this it would be great, maybe I did something wrong because I did it a bit in a hurry

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