mirror of
https://github.com/apache/commons-lang.git
synced 2025-02-07 18:48:39 +00:00
Applying Cedrik Lime's patch to LANG-413; improving the memory footprint of getLevenshteinDistance
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@630580 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5cbca4d5f5
commit
68c6547d0c
@ -5737,6 +5737,15 @@ allows us to retain the previous cost counts as required by the algorithm (takin
|
||||
return n;
|
||||
}
|
||||
|
||||
if (n > m) {
|
||||
// swap the input strings to consume less memory
|
||||
String tmp = s;
|
||||
s = t;
|
||||
t = tmp;
|
||||
n = m;
|
||||
m = t.length();
|
||||
}
|
||||
|
||||
int p[] = new int[n+1]; //'previous' cost array, horizontally
|
||||
int d[] = new int[n+1]; // cost array, horizontally
|
||||
int _d[]; //placeholder to assist in swapping p and d
|
||||
|
Loading…
x
Reference in New Issue
Block a user