man-pages/man3/Algorithm::Diff::XS.3pm.html
2021-03-31 01:06:50 +01:00

130 lines
3.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of Algorithm::Diff::XS</TITLE>
</HEAD><BODY>
<H1>Algorithm::Diff::XS</H1>
Section: User Contributed Perl Documentation (3pm)<BR>Updated: 2019-10-27<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
Algorithm::Diff::XS - Algorithm::Diff with XS core loop
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
# Drop-in replacement to Algorithm::Diff, but &quot;compact_diff&quot;
# and C&lt;LCSidx&gt; will run much faster for large data sets.
use Algorithm::Diff::XS qw( compact_diff LCSidx );
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
This module is a simple re-packaging of Joe Schaefer's excellent
but not very well-known Algorithm::LCS with a drop-in interface
that simply re-uses the installed version of the Algorithm::Diff
module.
<P>
Note that only the <TT>&quot;LCSidx&quot;</TT> function is optimized in <FONT SIZE="-1">XS</FONT> at the
moment, which means only <TT>&quot;compact_diff&quot;</TT> will get significantly
faster for large data sets, while <TT>&quot;diff&quot;</TT> and <TT>&quot;sdiff&quot;</TT> will run
in identical speed as <TT>&quot;Algorithm::Diff&quot;</TT>.
<A NAME="lbAE">&nbsp;</A>
<H2>BENCHMARK</H2>
<PRE>
Rate Algorithm::Diff Algorithm::Diff::XS
Algorithm::Diff 14.7/s -- -98%
Algorithm::Diff::XS 806/s 5402% --
</PRE>
<P>
The benchmarking script is as below:
<P>
<PRE>
my @data = ([qw/a b d/ x 50], [qw/b a d c/ x 50]);
cmpthese( 500, {
'Algorithm::Diff' =&gt; sub {
Algorithm::Diff::compact_diff(@data)
},
'Algorithm::Diff::XS' =&gt; sub {
Algorithm::Diff::XS::compact_diff(@data)
},
});
</PRE>
<A NAME="lbAF">&nbsp;</A>
<H2>SEE ALSO</H2>
Algorithm::Diff, Algorithm::LCS.
<A NAME="lbAG">&nbsp;</A>
<H2>AUTHORS</H2>
Audrey Tang &lt;<A HREF="mailto:cpan@audreyt.org">cpan@audreyt.org</A>&gt;
<A NAME="lbAH">&nbsp;</A>
<H2>COPYRIGHT</H2>
Copyright 2008 by Audrey Tang &lt;<A HREF="mailto:cpan@audreyt.org">cpan@audreyt.org</A>&gt;.
<P>
Contains derived code copyrighted 2003 by Joe Schaefer,
&lt;<A HREF="mailto:joe+cpan@sunstarsys.com">joe+cpan@sunstarsys.com</A>&gt;.
<P>
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
<DT id="2"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="3"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="4"><A HREF="#lbAE">BENCHMARK</A><DD>
<DT id="5"><A HREF="#lbAF">SEE ALSO</A><DD>
<DT id="6"><A HREF="#lbAG">AUTHORS</A><DD>
<DT id="7"><A HREF="#lbAH">COPYRIGHT</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:35 GMT, March 31, 2021
</BODY>
</HTML>