Skip to content

UCS/DATASTRUCT: Interval tree fixes#11213

Open
shasson5 wants to merge 3 commits intoopenucx:masterfrom
shasson5:tree2
Open

UCS/DATASTRUCT: Interval tree fixes#11213
shasson5 wants to merge 3 commits intoopenucx:masterfrom
shasson5:tree2

Conversation

@shasson5
Copy link
Contributor

What?

Some fixes that were not included in first Interval tree PR

Why?

Improve several points:

  1. fast path optimizations
  2. assertion more descriptive
  3. simplify allocations by using mpool directly
  4. support zero length intervals natively

tree->root = ucs_interval_tree_insert_node(tree->root, new_node);

/* Update single_node flag: tree is single node if root has no children */
tree->single_node = (tree->root->left == NULL) &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe have tree->num_nodes and do ++ every time we insert to it and -- when remove?

Comment on lines +30 to +32
ucs_interval_node_t *root; /**< Root node of the tree */
ucs_mpool_t *mpool; /**< Memory pool for node allocation */
int single_node; /**< Cached flag: 1 if tree has only root node */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: fix indent

@yosefe yosefe enabled auto-merge (squash) March 2, 2026 17:39
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

Successfully merging this pull request may close these issues.

2 participants