[Pmwiki-users] PHP Diff Engine

Nils Knappmeier nk
Thu Sep 23 15:45:51 CDT 2004


>Just to recap my previous concerns about PHP-based diff algorithms;
>many PHP installations have limits on the maximum amount of memory
>available for the script to use -- by default this is usually set to
>8 megabytes.  So, if we have a diff algorithm that requires a M x N
>table to compare texts of M and N lines, then we can quickly find ourselves
>  
>
It's been a while since I wrote it, but I think NxM memory is only the 
worst case.
The matching-matrix is not built in this version and in the matrix to 
remember to path
back to the source is only filled for the visited nodes. There are some 
other optimizations, such that, everything depends on the size the 
difference.
If you have a 1000 lines page and you change or add 5 lines, you should 
be fine.
Delete 100 lines and replaces them by hundred completely different lines 
and you might screw up.

>running out of memory when the texts reach a few hundred lines or so.
>But I'm guessing that's apparently not much of a problem since nobody
>using the PHPDiffEngine seems to have reported it... :)
>  
>
The version in the cookbook definitly doesn't need so much memory. And 
should run in n*log n time. The drawback are sometimes bad results...

Nils

>Pm
>
>
>  
>


-- 
---------------------------------------------
home: http://www.knappi.org
icq: 11786572

The great thing about being the only species that makes
a distinction between right and wrong is that we can 
make up the rules for ourselves as we go along.

Douglas Adams, Last Chance To See...




More information about the pmwiki-users mailing list