| 1 |
NAME |
| 2 |
Algorithm::Diff::XS - Algorithm::Diff with XS core loop |
| 3 |
|
| 4 |
SYNOPSIS |
| 5 |
# Drop-in replacement to Algorithm::Diff, but "compact_diff" |
| 6 |
# and C<LCSidx> will run much faster for large data sets. |
| 7 |
use Algorithm::Diff::XS qw( compact_diff LCSidx ); |
| 8 |
|
| 9 |
DESCRIPTION |
| 10 |
This module is a simple re-packaging of Joe Schaefer's excellent but not |
| 11 |
very well-known Algorithm::LCS with a drop-in interface that simply |
| 12 |
re-uses the installed version of the Algorithm::Diff module. |
| 13 |
|
| 14 |
Note that only the "LCSidx" function is optimized in XS at the moment, |
| 15 |
which means only "compact_diff" will get significantly faster for large |
| 16 |
data sets, while "diff" and "sdiff" will run in identical speed as |
| 17 |
"Algorithm::Diff". |
| 18 |
|
| 19 |
BENCHMARK |
| 20 |
Rate Algorithm::Diff Algorithm::Diff::XS |
| 21 |
Algorithm::Diff 14.7/s -- -98% |
| 22 |
Algorithm::Diff::XS 806/s 5402% -- |
| 23 |
|
| 24 |
The benchmarking script is as below: |
| 25 |
|
| 26 |
my @data = ([qw/a b d/ x 50], [qw/b a d c/ x 50]); |
| 27 |
cmpthese( 500, { |
| 28 |
'Algorithm::Diff' => sub { |
| 29 |
Algorithm::Diff::compact_diff(@data) |
| 30 |
}, |
| 31 |
'Algorithm::Diff::XS' => sub { |
| 32 |
Algorithm::Diff::XS::compact_diff(@data) |
| 33 |
}, |
| 34 |
}); |
| 35 |
|
| 36 |
SEE ALSO |
| 37 |
Algorithm::Diff, Algorithm::LCS. |
| 38 |
|
| 39 |
AUTHORS |
| 40 |
Audrey Tang <[email protected]> |
| 41 |
|
| 42 |
COPYRIGHT |
| 43 |
Copyright 2008 by Audrey Tang <[email protected]>. |
| 44 |
|
| 45 |
Contains derived code copyrighted 2003 by Joe Schaefer, |
| 46 |
<[email protected]>. |
| 47 |
|
| 48 |
This library is free software; you can redistribute it and/or modify it |
| 49 |
under the same terms as Perl itself. |
| 50 |
|