viirya commented on code in PR #19532:
URL: https://github.com/apache/datafusion/pull/19532#discussion_r2650365169
##########
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:
Okay, I refactored it to `generic_levenshtein_with_buffer`. Now
`generic_levenshtein` calls it.
--
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]