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