On Wed, Nov 18, 2009 at 12:42 PM, Lars Aronsson lars@aronsson.se wrote:
I'm talking about Wikipedia now. Are there different implementations of diff in various instances of MediaWiki? How is it implemented? Using UNIX/Linux diff, wdiff, or some other algorithm?
It's implemented out of the box in PHP, with a PHP extension written in C++ available for better speed.
http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/diff/ http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/wikidiff2/
wdiff isn't reliably available -- it's not installed by default on all (any?) Linux distros, and it's very unlikely to be installed on non-Linux servers. Moreover, even where it's installed, shared hosts often don't give PHP scripts the right to execute external programs -- that breaks out of PHP's sandboxes, and many shared hosts rely on those instead of Unix permissions.
Given all that, we need a PHP implementation of some kind. And once we have that, and need a faster version in C++ or such, I guess the logic goes that we may as well use the same algorithm for the sake of consistency. I don't know, wikidiff2 was written several months before I started MediaWiki development.