GeezerVison is showing github.com — chabicht/java-diff-utils@24c3df1
File treeExpand file treeCollapse file tree Open diff view settings main/java/com/github/difflib/algorithm/myers test/java/com/github/difflib/algorithm/myers
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: java-diff-utils/src/main/java/com/github/difflib/algorithm/myers/MeyersDiffWithLinearSpace.java -3Lines changed: 0 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -87,9 +87,6 @@ private void buildScript(DiffData data, int start1, int end1, int start2, int en | 87 | 87 | } | 88 | 88 | } else { | 89 | 89 | buildScript(data, start1, middle.start, start2, middle.start - middle.diag); | 90 | | -// for (int i = middle.getStart(); i < middle.getEnd(); ++i) { | 91 | | -// script.append(new KeepCommand<>(left.charAt(i))); | 92 | | -// } | 93 | 90 | buildScript(data, middle.end, end1, middle.end - middle.diag, end2); | 94 | 91 | } | 95 | 92 | } | |
Collapse file Copy file name to clipboardExpand all lines: java-diff-utils/src/test/java/com/github/difflib/algorithm/myers/MeyersDiffWithLinearSpaceTest.java +18Lines changed: 18 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 15 | 15 | */ | 16 | 16 | package com.github.difflib.algorithm.myers; | 17 | 17 |
| | 18 | +import com.github.difflib.DiffUtils; | 18 | 19 | import com.github.difflib.algorithm.DiffAlgorithmListener; | 19 | 20 | import com.github.difflib.patch.Patch; | 20 | 21 | import java.util.ArrayList; | 21 | 22 | import java.util.Arrays; | 22 | 23 | import java.util.List; | | 24 | +import static java.util.stream.Collectors.toList; | | 25 | +import java.util.stream.IntStream; | 23 | 26 | import org.junit.jupiter.api.Test; | 24 | 27 | import static org.junit.jupiter.api.Assertions.*; | 25 | 28 |
| @@ -70,4 +73,19 @@ public void diffEnd() { | 70 | 73 | System.out.println(logdata); | 71 | 74 | assertEquals(8, logdata.size()); | 72 | 75 | } | | 76 | + | | 77 | + | | 78 | + @Test | | 79 | + public void testPerformanceProblemsIssue124() { | | 80 | + List<String> old = Arrays.asList("abcd"); | | 81 | + List<String> newl = IntStream.range(0, 90000) | | 82 | + .boxed() | | 83 | + .map(i -> i.toString()) | | 84 | + .collect(toList()); | | 85 | + | | 86 | + long start = System.currentTimeMillis(); | | 87 | + Patch<String> diff = DiffUtils.diff(old, newl, new MeyersDiffWithLinearSpace<String>()); | | 88 | + long end = System.currentTimeMillis(); | | 89 | + System.out.println("Finished in " + (end - start) + "ms and resulted " + diff.getDeltas().size() + " deltas"); | | 90 | + } | 73 | 91 | } |
Collapse file Copy file name to clipboardExpand all lines: java-diff-utils/src/test/java/com/github/difflib/algorithm/myers/WithMeyersDiffWithLinearSpacePatchTest.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -95,7 +95,7 @@ public void testPatch_Change_withExceptionProcessor() { | 95 | 95 | List<String> data = DiffUtils.patch(changeTest_from, patch); | 96 | 96 | assertEquals(11, data.size()); | 97 | 97 |
| 98 | | - assertEquals(Arrays.asList("aaa", "<<<<<< HEAD", "bbb", "CDC", "======", "bbb", "ccc", ">>>>>>> PATCH", "ddd"), data); | | 98 | + assertEquals(Arrays.asList("aaa", "bxb", "cxc", "<<<<<< HEAD", "bbb", "CDC", "======", "bbb", "ccc", ">>>>>>> PATCH", "ddd"), data); | 99 | 99 |
| 100 | 100 | } catch (PatchFailedException e) { | 101 | 101 | fail(e.getMessage()); | |
|