Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
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
iteratorclass 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: