Algori...iff::XS(3pm)
β¨ NAME β¨
okay so the manual name here is Algorithm::Diff::XS(3pm) π and it's basically Algorithm::Diff but with an XS core loop running underneath π₯
π SYNOPSIS π
# Drop-in replacement to Algorithm::Diff, but "compact_diff"
# and C<LCSidx> will run much faster for large data sets.
use Algorithm::Diff::XS qw( compact_diff LCSidx );
πΈ DESCRIPTION πΈ
bestie, 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 just re-uses the installed version of the Algorithm::Diff module. no cap, it's giving easy setup π«Ά
ngl there's a catch π only the LCSidx function is optimized in XS at the moment. that means only compact_diff gets significantly faster on large data sets, while diff and sdiff run at the exact same speed as Algorithm::Diff. lowkey a little disappointing but still iconic π
π BENCHMARK π
okay the numbers are wild π
Rate Algorithm::Diff Algorithm::Diff::XS
Algorithm::Diff 14.7/s -- -98%
Algorithm::Diff::XS 806/s 5402% --
the benchmarking script is as below π§
my @data = ([qw/a b d/ x 50], [qw/b a d c/ x 50]);
cmpthese( 500, {
'Algorithm::Diff' => sub {
Algorithm::Diff::compact_diff(@data)
},
'Algorithm::Diff::XS' => sub {
Algorithm::Diff::XS::compact_diff(@data)
},
});
π SEE ALSO π
bestie go check out Algorithm::Diff and Algorithm::LCS π
π AUTHORS π
Audrey Tang <cpan@audreyt.org> is the queen π«Ά
π¦ COPYRIGHT π¦
Copyright 2008 by Audrey Tang <cpan@audreyt.org>. π
Contains derived code copyrighted 2003 by Joe Schaefer, <joe+cpan@sunstarsys.com>. π
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. no cap, that's the vibe β¨
bestie that's the whole tea π«π this page came from perl v5.40.1, dated 2025-03-15, and it's lowkey the most iconic Algorithm::Diff::XS(3pm) manpage you'll ever read πΈβ¨
π¦ where this page comes from
- debian trixie: libalgorithm-diff-xs-perl 0.04-9 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu questing: libalgorithm-diff-xs-perl 0.04-9 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libalgorithm-diff-xs-perl 0.04-9 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms