data tree OPTIMIZE use hashes if possible in lyd_target
diff --git a/src/tree_data.c b/src/tree_data.c
index de3b39f..c2283c9 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -1443,7 +1443,13 @@
     u = 0;
     while (u < LY_ARRAY_SIZE(path)) {
         /* find next node instance */
-        lyd_find_sibling_next2(start_sibling, path[u].node, NULL, 0, &node);
+        if (start_sibling && !start_sibling->prev->next && !(path[u].node->nodetype & (LYS_LEAFLIST | LYS_LIST))) {
+            /* starting from the beginning using hashes */
+            lyd_find_sibling_val(start_sibling, path[u].node, NULL, 0, &node);
+        } else {
+            /* next matching sibling */
+            lyd_find_sibling_next2(start_sibling, path[u].node, NULL, 0, &node);
+        }
         if (!node) {
             break;
         }
@@ -1463,7 +1469,7 @@
                 struct lysc_type *type = ((struct lysc_node_leaf *)path[u].predicates[x].key)->type;
                 struct lyd_node *key;
 
-                lyd_find_sibling_next2(lyd_node_children(node), path[u].predicates[x].key, NULL, 0, &key);
+                lyd_find_sibling_val(lyd_node_children(node), path[u].predicates[x].key, NULL, 0, &key);
                 if (!key) {
                     /* probably error and we shouldn't be here due to previous checks when creating path */
                     match = 0;