From: Jeff D. <da...@da...> - 2000-06-28 19:18:25
|
Hi Steve, Arno, et. al. I've just set up a new experimental Wiki at http://www.dairiki.org/HammondWiki/ . (It's dedicated to Hammond organs in case that wasn't obvious.) It's based upon phpwiki 1.1.6b. Great work! And thanks! One of the things I'd like to see added is diff's from the previous version like the ones you get by clicking on the last edit date in the c2.com wiki. I see in the phpwiki-talk archives that there was some talk of diff's a couple of weeks ago, but that there was some hesitancy at the idea of implementing the diff functionality within PHP. (The motivation of that discussion appears to be the desire to keep an RCS-like history of all changes to the Wiki.) There's a (somewhat well documented) Perl implementation of the diff algorithm at: http://www.plover.com/~mjd/perl/diff/ I suspect this could be used as the basis of a PHP implementation. With some encouragement from you(all) I could even be convinced to work on the conversion. Interested? Best Regards, Jeff |
From: Arno H. <aho...@in...> - 2000-06-28 21:32:33
Attachments:
diff.php3
|
Hi Jeff, > One of the things I'd like to see added is diff's from the previous version > like the ones you get by clicking on the last edit date in the c2.com wiki. > There's a (somewhat well documented) Perl implementation of the > diff algorithm at: > http://www.plover.com/~mjd/perl/diff/ Thanks for pointing this out. I hacked around a little bit and came up with a somewhat simplified php version of the perl-diff by mjd. It is attached below. To test it on your computer change those file() calls to actual existing files. I guess it should be easy to include this into phpwiki. /Arno |
From: Jeff D. <da...@da...> - 2000-06-29 07:12:35
Attachments:
wiki_diff.php3
|
> > There's a (somewhat well documented) Perl implementation of the > > diff algorithm at: > > http://www.plover.com/~mjd/perl/diff/ > >Thanks for pointing this out. Actually, this afternoon, I discovered that there's a newer and more memory efficient version of Algorithm::Diff on the CPAN. (In the old version LCS_matrix() populates an m by n matrix; where m and n are the lengths of the files be diffed.) >I hacked around a little bit and came up with a somewhat simplified >php version of the perl-diff by mjd. I've done a bit more reading, and have looked closed at the GNU diffutils sources. This afternoon I hacked together my own PHP diff engine. I think it's working, though I'd like to test it a bit more. Here it is if you'd like to check it out. Features: o Memory requirements are linear in file size, rather than quadratic. o Fancy colorized diff output (either unified diffs or plain diffs). o Diffs can be serialized, deserialized, and applied to a file. (i.e. this code is ready to be used in a version control system.) Computation time is still quadratic in file size. I did not include in the code the heuristics which GNU diff uses to get around this, though it could be easily done. As long as the files involved are not more than a few hundred lines in length, it's probably not an issue. Jeff |
From: Arno H. <aho...@in...> - 2000-06-29 16:29:16
|
Jeff, > I've done a bit more reading, and have looked closed at the GNU diffutils > sources. This afternoon I hacked together my own PHP diff engine. I think > it's working, though I'd like to test it a bit more. Here it is if you'd > like to check it out. great! impressive stuff :o) I added it to the phpwiki right away. I had to modify the WikiDiffFormatter class so that it works with templates. Check out the latest CVS. > Computation time is still quadratic in file size. I did not include > in the code the heuristics which GNU diff uses to get around this, though > it could be easily done. As long as the files involved are not more than > a few hundred lines in length, it's probably not an issue. The test file you supplied has about 220 lines. On my machine (128MB, AMD K6-2 450 Mhz) computation takes about 0.2 sec. I guess that's reasonable. Diff will be a seldom used feature. /Arno |
From: Jeff D. <da...@da...> - 2000-06-29 16:58:35
|
Hi Arno, >great! impressive stuff :o) Thanks! >I added it to the phpwiki right away. >I had to modify the WikiDiffFormatter class so that it works with templates. > >Check out the latest CVS. Great. I guess now I'll have to remember how to CVS. I want to test it a bit more and add a couple more features. (Option to make WikiDiffFormatter output reverse diffs; a WikiDiff->compose method.) >The test file you supplied has about 220 lines. >On my machine (128MB, AMD K6-2 450 Mhz) computation takes about 0.2 sec. >I guess that's reasonable. Diff will be a seldom used feature. That's actually a bit worrysome. (I hadn't done any profiling yet. Is there a good way to profile PHP?) Those test files are a particularly simple case, as there is only one diff in the middle of the file. The first thing WikiDiffEngine does is ignore the common lines at the beginning and end of each file. This leaves only 9 lines in the first file and 2 in the second. On second thought: how did you get that time? Is it possible that it includes the download time for the test files (they get read from sourceforge.net.) Jeff |
From: Steve W. <sw...@wc...> - 2000-06-29 19:37:05
|
On Thu, 29 Jun 2000, Jeff Dairiki wrote: > >The test file you supplied has about 220 lines. > >On my machine (128MB, AMD K6-2 450 Mhz) computation takes about 0.2 sec. > >I guess that's reasonable. Diff will be a seldom used feature. > > That's actually a bit worrysome. (I hadn't done any profiling yet. > Is there a good way to profile PHP?) Oh, I think that's more than adequate. WikiWikiWebDoesNotScale so speed is not too great a concern, though don't use that as a license to write bubble sorts! ;-) sw ...............................ooo0000ooo................................. Hear FM quality freeform radio through the Internet: http://wcsb.org/ home page: www.wcsb.org/~swain |
From: Steve W. <sw...@wc...> - 2000-06-29 23:30:15
|
I just wanted to tell you both, excellent work! (Especially Jeff!) I just got home, ran "cvs update" and tried out the new diff feature. It's fantastic! Jeff, if you are interested in becoming a contributor, I can set you up for CVS access, but you'll have to give me your sourceforge account name. still amazed, sw ...............................ooo0000ooo................................. Hear FM quality freeform radio through the Internet: http://wcsb.org/ home page: www.wcsb.org/~swain |
From: Arno H. <aho...@in...> - 2000-06-30 17:40:41
|
Hi Jeff, welcome to the phpwiki development team :o) > >The test file you supplied has about 220 lines. > >On my machine (128MB, AMD K6-2 450 Mhz) computation takes about 0.2 sec. > >I guess that's reasonable. Diff will be a seldom used feature. > > On second thought: how did you get that time? Is it possible that > it includes > the download time for the test files (they get read from sourceforge.net.) Download-time is not included. I did a simple loop over $diff = new WikiDiff($archive['content'], $wiki['content']); and timed that loop only. 250 diffs take 48 sec - makes 0.2sec per diff. Not 100% accurate, but good enough for getting a rough estimate. /Arno |