Jefffrey commented on code in PR #19532:
URL: https://github.com/apache/datafusion/pull/19532#discussion_r2650116173
##########
datafusion/common/src/utils/mod.rs:
##########
@@ -741,6 +741,43 @@ pub mod datafusion_strsim {
generic_levenshtein(&StringWrapper(a), &StringWrapper(b))
}
+ /// Calculates the Levenshtein distance using a reusable cache buffer.
+ /// This avoids allocating a new Vec for each call, improving performance
+ /// when computing many distances.
+ ///
+ /// The `cache` buffer will be resized as needed and reused across calls.
+ pub fn levenshtein_with_buffer(a: &str, b: &str, cache: &mut Vec<usize>)
-> usize {
Review Comment:
I wonder if there's a way to unify this with `generic_levenshtein` to avoid
duplication, something like having `generic_levenshtein` call this but creating
a vec buffer at the callsite? 🤔
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]