-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Description
Lines 37 to 40 in e693023
| // Diff returns a string containing a line-by-line unified diff of the linewise | |
| // changes required to make A into B. Each line is prefixed with '+', '-', or | |
| // ' ' to indicate if it should be added, removed, or is correct respectively. | |
| func Diff(A, B string) string { |
It seems if one input of Diff is empty, then the algorithm uses O(N^2) space, where N is the size of the other input.
The result is I see out of memory error if I diff an empty chunk with a non-empty chunk.
It'll be a good improvement if we can just do an empty check before calling the Diff algorithm. And generating diffstring in such case should not be very hard.
Metadata
Metadata
Assignees
Labels
No labels