mjmwired / google-diff-match-patch

Automatically exported from code.google.com/p/google-diff-match-patch
Apache License 2.0
0 stars 0 forks source link

Line-by-line mode sub-optimal. #38

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Diff sometimes doesn't find what should be trivial differences.

What steps will reproduce the problem?
1. Use the website to compare the two attached texts 
2. Compare v1text to v2text
3. Compare v2text to v1text

What is the expected output? What do you see instead?

The only difference between these two texts is the years.  2009 vs 2010

In one case this is computed correctly.
In the other case, you see one large block of text inserted, and
another large block of text deleted.  (timeout was set to 0)

What version of the product are you using? On what operating system?

http://neil.fraser.name/software/diff_match_patch/svn/trunk/demo/demo_diff.html

Please provide any additional information below.

Shouldn't the output be symmetric?

Original issue reported on code.google.com by garyor...@gmail.com on 19 Jan 2011 at 9:57

Attachments:

GoogleCodeExporter commented 8 years ago
Confirmed.  Investigation shows that this is the result of the line-by-line 
speedup.  There exist cases such as this one where this speedup is sub-optimal. 
 Your example is the worst I've ever seen.  I need to take a closer look at 
whether this speedup is worth it.

If you want a truly accurate diff, use diff_main(text1, text2, false).  The 
third argument (which defaults to true) controls the line-by-line speedup.

Original comment by neil.fra...@gmail.com on 20 Jan 2011 at 1:43

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Issue 46 has been merged into this issue.

Original comment by neil.fra...@gmail.com on 13 May 2011 at 11:20

GoogleCodeExporter commented 8 years ago
The root cause has been unexpectedly tracked down to diff_cleanupSemantic and a 
changelist has been submitted for review.  Should take a week before it is 
published.

Original comment by neil.fra...@gmail.com on 14 May 2011 at 3:51

GoogleCodeExporter commented 8 years ago
Sorry for the delay.  I've just pushed a new version which fixes this class of 
issues.  As always, the upgrade is a drop-in replacement.

Original comment by neil.fra...@gmail.com on 3 Jun 2011 at 5:55