DescriptionReduce memory use of GetLevenshteinDistance() by almost 50%
Probably not measurable, but it's also a bit shorter, so probably worth it.
This is a port of my change
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20150713/286948.html
where I explained the idea like so:
// Although the algorithm is typically described using an m x n
// array, only one row plus one element are used at a time, so this
// implementation just keeps one vector for the row. To update one entry,
// only the entries to the left, top, and top-left are needed. The left
// entry is in row[x-1], the top entry is what's in row[x] from the last
// iteration, and the top-left entry is stored in previous.
No intended behavior change.
BUG=none
Committed: https://crrev.com/4967b70a63b618a6e508db88c2fa9c5dbef206f4
Cr-Commit-Position: refs/heads/master@{#376015}
Patch Set 1 #Patch Set 2 : . #Patch Set 3 : test cases #Patch Set 4 : whoops #Patch Set 5 : compile? #
Total comments: 1
Patch Set 6 : . #Messages
Total messages: 24 (8 generated)
|