You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: More optimal IterateHierarchyV2 and iterateChildrenV2 [#600] (#601)
* chore: More optimal IterateHierarchyV2 and iterateChildrenV2 [#600]
Closes#600
The existing (effectively v1) implementations are suboptimal since they don't construct a graph before the iteration. They search for children by looking at all namespace resources and checking `isParentOf`, which can give `O(tree_size * namespace_resources_count)` time complexity. The v2 algorithms construct the graph and have `O(namespace_resources_count)` time complexity. See more details in the linked issues.
Signed-off-by: Andrii Korotkov <[email protected]>
* improvements to graph building
Signed-off-by: Michael Crenshaw <[email protected]>
* use old name
Signed-off-by: Michael Crenshaw <[email protected]>
* chore: More optimal IterateHierarchyV2 and iterateChildrenV2 [#600]
Closes#600
The existing (effectively v1) implementations are suboptimal since they don't construct a graph before the iteration. They search for children by looking at all namespace resources and checking `isParentOf`, which can give `O(tree_size * namespace_resources_count)` time complexity. The v2 algorithms construct the graph and have `O(namespace_resources_count)` time complexity. See more details in the linked issues.
Signed-off-by: Andrii Korotkov <[email protected]>
* finish merge
Signed-off-by: Michael Crenshaw <[email protected]>
* chore: More optimal IterateHierarchyV2 and iterateChildrenV2 [#600]
Closes#600
The existing (effectively v1) implementations are suboptimal since they don't construct a graph before the iteration. They search for children by looking at all namespace resources and checking `isParentOf`, which can give `O(tree_size * namespace_resources_count)` time complexity. The v2 algorithms construct the graph and have `O(namespace_resources_count)` time complexity. See more details in the linked issues.
Signed-off-by: Andrii Korotkov <[email protected]>
* discard unneeded copies of child resources as we go
Signed-off-by: Michael Crenshaw <[email protected]>
* remove unnecessary comment
Signed-off-by: Michael Crenshaw <[email protected]>
* make childrenByUID sparse
Signed-off-by: Michael Crenshaw <[email protected]>
* eliminate duplicate map
Signed-off-by: Michael Crenshaw <[email protected]>
* fix comment
Signed-off-by: Michael Crenshaw <[email protected]>
* add useful comment back
Signed-off-by: Michael Crenshaw <[email protected]>
* use nsNodes instead of dupe map
Signed-off-by: Michael Crenshaw <[email protected]>
* remove unused struct
Signed-off-by: Michael Crenshaw <[email protected]>
* skip invalid APIVersion
Signed-off-by: Michael Crenshaw <[email protected]>
---------
Signed-off-by: Andrii Korotkov <[email protected]>
Signed-off-by: Michael Crenshaw <[email protected]>
Co-authored-by: Michael Crenshaw <[email protected]>
0 commit comments