Skip to content
This repository has been archived by the owner on Jul 1, 2023. It is now read-only.

Investigate the more complex variants of Myers' diff algorithm #20

Open
fredemmott opened this issue Jul 9, 2019 · 1 comment
Open

Comments

@fredemmott
Copy link
Contributor

fredemmott commented Jul 9, 2019

This might result in better performance, and fewer hunks/more human-friendly diffs may be a side-effect (as it's closer to what other diff implementations use). It will not affect the length of the vec<DiffOp>

For example, diff and git diff produce:

@@ -1,5 +1,9 @@
 function testcase(): void {
-  some_function_with_a_long_name_and_several_args('aaaaaaaa', 'bbbbbbbb', 'cccccccc');
+  some_function_with_a_long_name_and_several_args(
+    'aaaaaaaa',
+    'bbbbbbbb',
+    'cccccccc',
+  );
   some_function_with_a_long_name_and_several_args(
     'xxxxxxxx',
     'yyyyyyyy',

Whereas difflib produces:

 function testcase(): void {
-  some_function_with_a_long_name_and_several_args('aaaaaaaa', 'bbbbbbbb', 'cccccccc');
   some_function_with_a_long_name_and_several_args(
+    'aaaaaaaa',
+    'bbbbbbbb',
+    'cccccccc',
+  );
+  some_function_with_a_long_name_and_several_args(
     'xxxxxxxx',
     'yyyyyyyy',
     'zzzzzzzz',
@fredemmott
Copy link
Contributor Author

@dakotareier fyi https://blog.jcoglan.com/2017/03/22/myers-diff-in-linear-space-theory/ gives some examples where these variants will give /less/ human-friendly diffs

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant