x/tools/internal/diff: maxDiffs is too small #71648
Labels
Refactoring
Issues related to refactoring tools
ToolProposal
Issues describing a requested change to a Go tool or command-line program.
Milestone
Here are two diffs produced by the internal/diff package (via
modernize -fix -diff
) using different values (1000 and 100) of the maxDiffs constant. The first is very precise; the second is very rough. However, the first costs (in theory) up to 100x more memory.What value of maxDiffs should we use? Can we afford 1000? Will that break down for larger files? What do state-of-the-art diff tools do?
@pjweinb
(Aside: the first diff would be even better if adjacent insertions and deletions were preserved rather than interleaved. This may be a consequence of the unified diff conversion, which expands byte-oriented diffs to whole lines but perhaps misses an opportunity to coalesce hunks that, as a result, now abut each other. Not sure.)
maxDiffs=1000
maxDiffs=100 (current default)
The text was updated successfully, but these errors were encountered: