tree data OPTIMIZE faster opaque node search

Assumes there are only few opaque nodes compared
to the data nodes.
diff --git a/src/tree_data.c b/src/tree_data.c
index 7cd608e..a5a0201 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -2820,8 +2820,22 @@
 {
     LY_CHECK_ARG_RET(NULL, name, LY_EINVAL);
 
+    if (first && first->schema) {
+        first = first->prev;
+        if (first->schema) {
+            /* no opaque nodes */
+            first = NULL;
+        } else {
+            /* opaque nodes are at the end, find quickly the first */
+            while (!first->prev->schema) {
+                first = first->prev;
+            }
+        }
+    }
+
     for ( ; first; first = first->next) {
-        if (!first->schema && !strcmp(LYD_NAME(first), name)) {
+        assert(!first->schema);
+        if (!strcmp(LYD_NAME(first), name)) {
             break;
         }
     }