perf(tree): optimize input_char_count calculation (#16238)
This commit is contained in:
@@ -554,7 +554,6 @@ impl Tree {
|
|||||||
} else {
|
} else {
|
||||||
// Partial match - still use this node for tenant selection
|
// Partial match - still use this node for tenant selection
|
||||||
matched_chars += shared_count;
|
matched_chars += shared_count;
|
||||||
remaining = advance_by_chars(remaining, shared_count);
|
|
||||||
prev = matched_node;
|
prev = matched_node;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -607,8 +606,10 @@ impl Tree {
|
|||||||
.insert(Arc::clone(&tenant), epoch);
|
.insert(Arc::clone(&tenant), epoch);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute input char count from matched + remaining (deferred from start)
|
// Compute input char count directly from input text.
|
||||||
let input_char_count = matched_chars + remaining.chars().count();
|
// This is equivalent to matched_chars + remaining.chars().count() but avoids
|
||||||
|
// needing to track remaining precisely through the traversal.
|
||||||
|
let input_char_count = text.chars().count();
|
||||||
|
|
||||||
PrefixMatchResult {
|
PrefixMatchResult {
|
||||||
tenant,
|
tenant,
|
||||||
|
|||||||
Reference in New Issue
Block a user