Reduce memory usage of ComputeEditDistance() by (almost) 50%
authorNico Weber <nicolasweber@gmx.de>
Mon, 13 Jul 2015 21:33:21 +0000 (21:33 +0000)
committerNico Weber <nicolasweber@gmx.de>
Mon, 13 Jul 2015 21:33:21 +0000 (21:33 +0000)
commitb32a9f5c0fe0de3addeb223cad0b7dfe5844e5ca
tree8c7595f21da63ceb6cb4085d3b6165398658b7b5
parent71a4b301fd6ec12aa4962dcfdef5876dde858a10
Reduce memory usage of ComputeEditDistance() by (almost) 50%

ComputeEditDistance() currently keeps two rows of the edit distance matrix in
memory.  That's unnecessary, one row plus one additional element are sufficient.
With this change, strings up to 64 chars can be processed without going to the
heap, compared to 32 chars previously.  (But the main motivation is that the
code gets a bit simpler.)

No intended behavior change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242069 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/ADT/edit_distance.h