-
Notifications
You must be signed in to change notification settings - Fork 43
Prop enhacements #377
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
base: master
Are you sure you want to change the base?
Prop enhacements #377
Conversation
inserted property. This is necessary since list properties can be absorbed by existing list properties of the same type.
In Props.hh, there is some code
that could be removed as it doesn't do anything. I have been considering storing castability information to more quickly locate properties / avoid some dynamic casts. |
I should also add: I left all the get calls elsewhere intact, but many of these can presumably now be specialized when the property class in question is a final class. Maybe one could simply add a flag to get<> that decides whether to get by castability or get by actual property. For the latter, there is a |
This is a rewriting of the internal storage of the Properties class to organize properties in a more hierarchical way. This allows get<> routines to run faster, which is important when there are hundreds of properties (for example in an intricate supergravity computation with many fields / tensors). Which combined with the comparator modifications (submitted in a separate pull request), I find ~5x speedup on complicated expressions.
The basic idea is to group properties by their type, so that e.g. Indices properties all sit together. These are organized in
To eliminate some redundancy, I organized properties and patterns so that they always fundamentally sit in a propmap_t multimap, which itself sits inside a typemap_t.
The master typemap_t is the pats_dict, which is the analogue of the old pats.
To provide similar functionality as the old props, I introduced namemap_t, which maps names to typemaps. So a given prop/pat pair lives both in pats_dict and in props_dict.
(I swapped the props/pats order in props_dict relative to props because the above ends up being faster. Possibly this would be changed if patterns eventually become unique objects, i.e. a single pattern object can have multiple properties attached to it.)
To hide the internal storage from other classes, I introduce an
iterator
class and associatedbegin()
andend()
methods inProperties
.I also added functionality in Python to exhibit Property objects, with convenient erase() methods attached to them. The current display form of these could use some work.
Some comments: