[Helma-dev] Status quo of diff implementation

andreas.unterluggauer at orf.at andreas.unterluggauer at orf.at
Thu Jul 12 17:42:05 CEST 2007


hello,
 
I have implemented a String.diff() variant which uses the java-classes
from http://www.incava.org/projects/java/java-diff/
<http://www.incava.org/projects/java/java-diff/> . 
The java-classes have a LGPL license. 

The new String.diff is compatible with the old one with some minor
exceptions. The ordering of the insertions and deletions could differ
because there could be more than one LCS with the same length. And in
the result-array of the old implentation there are objects where all
properties are undefined, in the new variant I am not returning these
objects.
My tests shows, that the new implemantation is a little faster  (maybe
5%) than the old one.
 
Should I try to replace Diff.java with the java-diff classes? 
I also looked at diff_match_patch from Fraser. It looks fast, but its
only possible to make a character-diff. like the source-code is
implemented, I see no ease way to change it, so that it makes a line- or
word-wise diff.


should I try to replace the diff.java class with a compatible variant,
which uses java-diff, or is this unnecessary?

andi
 

________________________________

	From: helma-dev-bounces at helma.org
[mailto:helma-dev-bounces at helma.org] On Behalf Of tobias.schaefer at orf.at
	Sent: Mittwoch, 04. Juli 2007 09:16
	To: helma-dev at helma.org
	Subject: [Helma-dev] Status quo of diff implementation
	
	

	Hello
	
	I accidentally came across John Resig's JavaScript diff
implementation [1] (which is not really good, btw.) which reminded me
about the issue with the current diff implementation in Helma.
	
	What's the current status quo? Is the GPL license still an
issue?
	
	Wikipedia claims that the Apache 2 license would be compatible
with the GPLv3 [2];
	is the Helma license compatible, too?
	
	I looked around for other JS diff implementations and here's
what I found potentially usable:
	
	Neil Fraser's diff_match_patch [3] licensed with LGPL. Also note
his excellent writing about the diff algorithm in general [4].
	
	Cacycle's diff implementation for wikEd, "a Mediawiki in-browser
editor" [5] (Public Domain). Probably a litte troublesome to adapt with
all the global variables.
	
	XinDiff in JavaScript [6] (LGPL). Not as good as the others.
	
	Ciao,
	tobi
	
	--
	
	[1] http://ejohn.org/projects/javascript-diff-algorithm/
	[2]
http://en.wikipedia.org/wiki/GNU_General_Public_License#Version_3
	[3] http://code.google.com/p/google-diff-match-patch/
	[4] http://neil.fraser.name/writing/diff/
	[5] http://en.wikipedia.org/wiki/User:Cacycle/diff
	[6] http://sourceforge.net/projects/xindiff
	



More information about the Helma-dev mailing list