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.
Adds (internal)
Component::forEachImmediateSubcomponent
,Component::findImmediateSubcomponentByName
APIs and uses them to reimplementComponent
(so that it isn't manually looping as much) and reimplementtraversePathToComponent
(which was over-templated and allocated memory for subcomponent vectors.I noticed that path traversal in OpenSim takes significant time. One of the reasons that this is the case is because
traversePathToComponent
ends up allocating and pushing pack pointers to subcomponents in order to perform a linear name search.Fixes issue N/A
Brief summary of changes
private
helper function:Component::forEachImmediateSubcomponent
, which can be used in cases where code wants to iterate over the three collections of subcomponents stored byComponent
.private
helper function:Component::findImmediateSubcomponentByName
, which can be used to find an immediate subcomponent by its name (currently, via linear probing).forEachImmediateSubcomponent
the parts ofComponent
where it makes sense, so that the code is ready for a next-stage refactor (e.g. of adding aSubcomponents
class that encapsulates the subcomponent mess).findImmediateSubcomponentByName
totraversePathToComponent
, so that it can find an immediate subcomponent by name without having to first allocate a vector of pointers to subcomponentstraversePathToComponent
Testing I've completed
Looking for feedback on...
CHANGELOG.md
This change is