Reduce 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 Review URL: https://codereview.chromium.org/1690593002 Cr-Commit-Position: refs/heads/master@{#376015}
Loading
Please register or sign in to comment