Skip to content

Commit

Permalink
tree_data OPTIMIZE don't check dups on htable insertion
Browse files Browse the repository at this point in the history
When inserting a node into the children hash table, we check that
it was not already added, using a pointer comparison.

This check can take a lot of time if there is a lot of collisions
in the hash table, which is the case for keyless lists.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
  • Loading branch information
olivier-matz-6wind committed Sep 25, 2023
1 parent b5e605d commit 912de25
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tree_data_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ lyd_insert_hash_add(struct ly_ht *ht, struct lyd_node *node, ly_bool empty_ht)
assert(ht && node && node->schema);

/* add node itself */
if (lyht_insert(ht, &node, node->hash, NULL)) {
if (lyht_insert_no_check(ht, &node, node->hash, NULL)) {
LOGINT_RET(LYD_CTX(node));
}

Expand Down

0 comments on commit 912de25

Please sign in to comment.