SysDiff

Summary: Use an external "diff" program to speed saving of long pages.
Version: 2007-03-21
Prerequisites:
Status: Stable
Maintainer: Petko (original author: Pm)
Categories: Administration, PHP72

Questions answered by this recipe

  • Saving pages takes a while on my site -- can I speed it up?
  • Is there a way to use an external diff(1) program for page history?

Discussion

The sysdiff.phpΔ script replaces PmWiki's internal "diff" algorithm (used to create page history) with a call to an external diff program.

Since version 1.0.10, PmWiki has been distributed with a PHP-based algorithm for generating page history information. This makes PmWiki easy to install and use on a wider variety of platforms.

However, there may be situations where the PHP-based algorithm is less than ideal; for example, it may exceed PHP's memory limits for large pages or may take a long time to execute. In these cases, it may be worthwhile to use an external diff program for speed and memory efficiency. This is also known as "version control" or "revision control".

To use the sysdiff.phpΔ script, simply copy it into the cookbook/ directory and add the following line to local/config.php:

    include_once('cookbook/sysdiff.php');

The script will automatically switch PmWiki to use the external diff program located at /usr/bin/diff. If your system has a different location for its diff executable, or if you need to pass certain options to diff, then set the $SysDiffCmd variable appropriately.

This page has the cookbook recipe enabled, although you won't notice much difference (ouch, bad pun! :-).

Notes and Comments

Contributors

  • Pm, 2005-02-01

User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.