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 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