Skip to content

Commit 8e2ab4f

Browse files
Remove some redundant AVL searches
1 parent 9f2dbe5 commit 8e2ab4f

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

lib/msprime.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4135,8 +4135,7 @@ msp_merge_n_ancestors(msp_t *self, avl_tree_t *Q, population_id_t population_id,
41354135
tsk_bug_assert(u->lineage != NULL);
41364136
if (u->lineage->population != population_id) {
41374137
current_pop = &self->populations[u->lineage->population];
4138-
avl_node = avl_search(&current_pop->ancestors[label], u->lineage);
4139-
tsk_bug_assert(avl_node != NULL);
4138+
avl_node = &u->lineage->avl_node;
41404139
ret = msp_move_individual(
41414140
self, avl_node, &current_pop->ancestors[label], population_id, label);
41424141
if (ret != 0) {
@@ -5804,11 +5803,7 @@ static int
58045803
msp_change_label(msp_t *self, lineage_t *lin, label_id_t label)
58055804
{
58065805
avl_tree_t *pop = &self->populations[lin->population].ancestors[lin->label];
5807-
avl_node_t *node;
5808-
5809-
/* Find the this individual in the AVL tree. */
5810-
node = avl_search(pop, lin);
5811-
tsk_bug_assert(node != NULL);
5806+
avl_node_t *node = &lin->avl_node;
58125807
return msp_move_individual(self, node, pop, lin->population, label);
58135808
}
58145809

0 commit comments

Comments
 (0)